# Transformation of $\cos(x)$ to $\sin(x)$ via $\cos(-x+\frac{\pi}{2}) = \sin(x)$

I would like to ask a question regarding the transformation of the graph $\cos(x)$ into $\sin(x)$ by means of transformations of graphs.

I used Desmos to render $3$ equations - $\cos(x)$, $\cos(-x)$ and $\cos(-x + \frac{\pi}{2})$

Now, when I transform $\cos(x)$ into $\cos(-x)$, this is a reflection in the $y$-axis, hence there is no change so the two graphs overlap.

However, when I add $\frac{\pi}{2}$, I expected the graph to shift left by $\frac{\pi}{2}$ but instead it shifts right by $\frac{\pi}{2}$ to give the sine function.

I might be missing something here, but why does this happen?

• because you have $-x$, the shift is reversed. – Vasya Mar 22 '18 at 22:39

Cosine is an even function; hence, $\cos(x)=\cos(-x)$. For $\cos(-x+\frac{\pi}{2})$, you can multiply the argument by $-1$ and not change the value of the function, which gives $\cos(x-\frac{\pi}{2})$. Now the transformation is clearly a shift to the right by $\frac\pi2$ which yields the sine function.
To correctly determine to which direction the graph of any given function $$f{(x)}$$ shift upon a given transformation $$f{(a+x)}$$ or $$f{(a-x)}$$ ask yourself the following question.
"if $$f{(x)}$$ was $$f{(0)}$$ at $$x=0$$ for what value of $$x$$ will $$f{(a-x)}$$ be equal to $$f{(0)}$$."
The answer (i.e. $$a$$ here) will be the number you need to shift the graph to the right
(If the answer was "$$-a$$" you'd have to shift "$$-a$$" units to the right ,meaning, shifting "$$a$$" units to the left) . now you would have the transformed graph.