I have the following expression:
$$\left( \frac{\cos \beta \sin \beta \cos\phi +\sin \beta}{\sin^2 \phi + \sin^2\beta \cos^2 \phi} \right)^2\cos \phi$$
Wolfram Alpha yields a simplified form of this as, $$\frac{\sin^2 \beta \cos \phi}{(\cos \beta \cos \phi -1)^2}$$
I can multiply the first expression out and get,
$$\frac{\cos^2\beta \sin^2\beta \cos^2 \phi +\sin^2 \beta +2 \cos \beta \sin^2 \beta \cos \phi}{\sin^4 \phi + \sin^4\beta \cos^4 \phi + 2 \sin^2 \beta \sin^2 \phi \cos^2 \phi}$$
but after that I can't see the way forward to get the simplified W-A expression.
$$\left( \frac{\cos \beta \sin \beta \cos\phi +\sin \beta}{\sin^2 \phi + \sin^2\beta \cos^2 \phi} \right)^2\cos \phi=\sin^2\beta\cos\phi\left( \frac{\cos\beta\cos\phi+1}{\sin^2 \phi + \sin^2\beta\cos^2\phi}\right)^2$$ It remains to show that (up to sign, because this is in a square) $$\frac{\cos\beta\cos\phi+1}{\sin^2 \phi +\sin^2\beta\cos^2\phi}=\frac1{\cos\beta\cos\phi-1}$$ This can be established as follows: $$\frac{\cos\beta\cos\phi+1}{\sin^2 \phi +\sin^2\beta\cos^2\phi}=\frac{\cos\beta\cos\phi+1}{1-\cos^2\phi+\sin^2\beta\cos^2\phi}=\frac{\cos\beta\cos\phi+1}{1-(1-\sin^2\beta)\cos^2\phi}=\frac{\cos\beta\cos\phi+1}{1-\cos^2\beta\cos^2\phi}=\frac1{1-\cos\beta\cos\phi}$$ where we have used the difference of two squares in the last step.