# Step function from inverse tangent

it shows that $$x+2\tan^{-1}{\left(\frac{\cos{x}}{2+\sin{x}}\right)}$$ and $$2\tan^{-1}{\left(\frac{4+5\tan{\frac{x}{2}}}{3}\right)}$$ differ by a step function. I have no idea why this is true and am not very good at trig identities. Can someone shed some light onto this? (What I'm looking for is a trig or algebra solution or indeed a geometry solution, not a calculus one because that is where the functions came from)

Writing $$\tan\dfrac x2=u$$ and using Weierstrass substitution
$$\dfrac{\cos x}{2+\sin x}=\frac{1-t^2}{1+t^2}/\frac{2(1+t^2)+2t}{1+t^2}=\frac{1-t^2}{2(1+t+t^2)}$$
$$\tan^{-1}\left(\frac{4+5\tan\dfrac x2}3\right)-\tan^{-1}\left(\dfrac{\cos x}{2+\sin x}\right)$$
$$=\tan^{-1}\frac{4+5t}3-\tan^{-1}\frac{1-t^2}{2(1+t+t^2)}$$
$$=\tan^{-1}\left(\frac{\dfrac{4+5t}3-\dfrac{1-t^2}{2(1+t+t^2)}}{1+\dfrac{4+5t}3\cdot\dfrac{1-t^2}{2(1+t+t^2)}}\right)$$
Bow simplify to find this to be $$\tan^{-1}\left(\tan\dfrac x2\right)=\dfrac x2$$