I am solving this problem and I am stuck on converting a point from rectangular to cylindrical coordinates.
The answer is from $B(0,5,0)$ to $B\left(5,\frac\pi 2,0\right)$.
The problem is when I try to get $\phi$ which is just equal to inverse tangent of $ \frac{y}{x} $. When I input it, $\tan^{-1} \left(\frac{5}{0}\right)$, I only get math error.
You're wrong: strictly speaking, $(r,\varphi)$ is the solution of the (non-linear) system: $$\begin{cases}r\cos\varphi=x,\\r\sin\varphi=y.\end{cases}$$ with the conditions $r>0,\enspace -\pi<\varphi\le \pi$.
Now this system is equivalent to $$r=\sqrt{x^2+y^2},\quad \phi=\arctan\frac yx$$ only if $\;1)\enspace x\neq 0$, $2)\enspace x>0$. If $x=0$, $\dfrac yx$ is undefined, whence the error.