Minimal perimeter The problem is: Find the angle to OX axis, at
which a line should be drawn through the point A
(a,b) (a>0, b>0), so, that triangle, formed by this
line and positive coordinate semi-axes had the
minimal perimeter. I.e. the triangle vertices are (0,0), and two intersection points of line passing through A with OX and OY axes: (x,0), x>0 and (0,y),y>0. 
I found the function appearance: the function to minimize is 
$$
f(\varphi)=\left({a\over\cos \varphi}+{b\over\sin \varphi}\right)(1+\cos \varphi+\sin \varphi)
$$
and found its derivative,but I failed to solve equation derivative=0: there is 4th degree equation with respect to $\sin\varphi$, $\cos\varphi$ which I failed to solve. The answer is known, it was in the same book, but I can't come to that answer. Could somebody, please, help me?
 A: I got the same function $f(\varphi)$ with $0<\varphi<\frac{\pi}{2}$, so I tried to derivate and to solve the equation:
\begin{equation}
f'(\varphi)=\left(a\frac{\sin\varphi}{\cos^2\varphi}-b\frac{\cos\varphi}{\sin^2\varphi}\right)(1+\cos\varphi+\sin\varphi)+\left(\frac{a}{\cos\varphi}+\frac{b}{\sin\varphi}\right)(-\sin\varphi+\cos\varphi)=\\=\left(a\frac{\sin\varphi}{\cos^2\varphi}-b\frac{\cos\varphi}{\sin^2\varphi}\right)(1+\cos\varphi+\sin\varphi)+\left(\frac{a}{\cos\varphi}+\frac{b}{\sin\varphi}\right)(-\sin\varphi+\cos\varphi)=\\=a\frac{\sin\varphi}{\cos^2\varphi}-b\frac{\cos\varphi}{\sin^2\varphi}+a\frac{\sin\varphi}{\cos\varphi}-b\frac{\cos^2\varphi}{\sin^2\varphi}+a\frac{\sin^2\varphi}{\cos^2\varphi}-b\frac{\cos\varphi}{\sin\varphi}-a\frac{\sin\varphi}{\cos\varphi}+a-b+b\frac{\cos\varphi}{\sin\varphi}\\=a\frac{\sin\varphi}{\cos^2\varphi}-b\frac{\cos\varphi}{\sin^2\varphi}-b\frac{\cos^2\varphi}{\sin^2\varphi}+a\frac{\sin^2\varphi}{\cos^2\varphi}+a-b=\\=\frac{a\sin^3\varphi-b\cos^3\varphi-b\cos^4\varphi+a\sin^4\varphi+a\sin^2\varphi\cos^2\varphi-b\sin^2\varphi\cos^2\varphi}{\sin^2\varphi\cos^2\varphi}=\\=\frac{a\sin^2\varphi(\sin^2\varphi+\sin\varphi+\cos^2\varphi)-b\cos^2\varphi(\cos^2\varphi+\cos\varphi+\sin^2\varphi)}{\sin^2\varphi\cos^2\varphi}=\\=\frac{a\sin^2\varphi(1+\sin\varphi)-b\cos^2\varphi(1+\cos\varphi)}{\sin^2\varphi\cos^2\varphi}
\end{equation}
Putting it equal zero:
\begin{equation}
\frac{a\sin^2\varphi(1+\sin\varphi)-b\cos^2\varphi(1+\cos\varphi)}{\sin^2\varphi\cos^2\varphi}=0\\a\sin^2\varphi(1+\sin\varphi)-b\cos^2\varphi(1+\cos\varphi)=0
\end{equation}
Now we can use $\sin\varphi=\frac{2t}{1+t^2}$ and $\cos\varphi=\frac{1-t^2}{1+t^2}$ with $t=\tan\frac{\varphi}{2}, \varphi\ne\pi+2k\pi$:
\begin{equation}
a\frac{4t^2}{(1+t^2)^2}\left(1+\frac{2t}{1+t^2}\right)-b\frac{(1-t^2)^2}{(1+t^2)^2}\left(1+\frac{1-t^2}{1+t^2}\right)=0\\4at^2\left(\frac{1+t^2+2t}{1+t^2}\right)-b(1-t^2)^2\left(\frac{1+t^2+1-t^2}{1+t^2}\right)=0\\4at^2\frac{(t+1)^2}{1+t^2}-b(1-t^2)^2\left(\frac{2}{1+t^2}\right)=0\\4at^2(t+1)^2-2b(1-t^2)^2=0\\2at^2(t+1)^2-b(1-t)^2(1+t)^2=0\\2at^2-b(1-t)^2=0\\2at^2-b(1+t^2-2t)=0\\(2a-b)t^2+2bt-b=0
\end{equation}
Solving this equation I got that the minimum is:
\begin{equation}
t=\frac{-b+\sqrt{2ab}}{2a-b}\\\tan\frac{\varphi}{2}=\frac{-b+\sqrt{2ab}}{2a-b}
\end{equation}
so $\varphi=2\arctan\frac{-b+\sqrt{2ab}}{2a-b}$.
This is my solution but if someone checked it I would be grateful; I hope it is helpful anyway.
