How does tanx = 1 be pi/4 or 5pi/4?????? I'm confused
Your query was as to how does tanx = 1 lead to x = pi/4 and 5pi/4
The reason for the same has been explained. tan pi/4 = 1 as well as tan 5pi/4 = 1 therefore x = pi/4 and 5pi/4 between 0 to 2pi. I hope now it is clear.
Tangent is a periodic function with period $\displaystyle \pi$. If, for some x and y, tan(x)= y then it is also true that $\displaystyle tan(x+ n\pi)= y$ for any integer, n. In particular, $\displaystyle tan(\pi/4)= \frac{sin(\pi/4)}{cos(\pi/4)}= \frac{\sqrt{2}/2}{\sqrt{2}/2}= 1$ so $\displaystyle tan(\pi/4+ \pi)= tan(5\pi/4)= 1$. It is also true that $\displaystyle tan(\pi/4- \pi)= tan(-3\pi/4)= 1$, that $\displaystyle tan(\pi/4+ 2\pi)= tan(9\pi/4)= 1$, and that, in general, $\displaystyle tan(\pi/4+ n\pi)= tan(((4n+1)/4)\pi)= 1$ for any integer, n.