In proving $\sin(\pi/2 - x) = \cos(x)$, in my book its given that
$$\sin \left(\frac{\pi}{2} - x\right) = \cos \left( \frac{\pi}{2} - \left(\frac{\pi}{2} - x \right)\right) = \cos x$$
So I understand this but im confused about how $\cos x$ is being obtained from $\cos(\pi/2-(\pi/2-x))$. Please explain it to me.
If you distribute the minus sign you see that
$$\frac \pi 2 - \left( \frac \pi 2 - x \right) = \frac \pi 2 - \frac \pi 2 + x = x$$