I was really stuck and tried many times to differentiate the following series, and tried to convince myself that the differential form of a triangular wave is the square wave.
But I couldn't work it out as I found those sins and cos dont match up
Square wave has this form

triangular wave has the following form

Can anyone show me how you differentiate triangular wave to get square? they are both sines.... I would imagine after differentiation you get a cos series for triangular wave. Thanks every one for helping!
Start with some graphical reasoning. When you plot these square and triangular waves, you'll notice that they need to be $\pi/2$ out of phase in order for the square wave to match up with the slope of the triangular wave; there will also be some vertical scaling you need to apply. This phase shift will explain why they are both $\sin$ series, and the scaling explains the change from $8$ to $4$.
Alternatively, just compute the derivative of the triangular wave series and show that it is a transformed square wave.