Lef $f$ be an odd function with period $\pi$ defined by $f(x)=\cos(x)$ where $0<x\leq \pi/2$.
Plot the graph of $f$ on $[-\pi, \pi]$.
The answer in my book is this:

But I don't understand why it isn't as follows: (My guess)

Could anybody explain to me?
Recall that an odd function is a function $f$ such that $f(x)=-f(-x)$. This is tantamount to taking the graph of the function to the right of the $y$-axis and reflecting it about the $x$-axis and $y$-axis consecutively. Thus, your graph should have some negative values in the range $[-\pi/2,0)$, which yours does not.
This determines the values of the function on $[-\pi/2,\pi/2]$ (though admittedly your function isn't defined at $0$, which could easily be corrected by defining it to be any value, say $0$). Notice that the length of this interval is $\pi$. Since $f$ is required to be periodic, this means that the values of $f$ on each interval $[-\pi/2+n\pi,\pi/2+n\pi]$ is determined by the values of $f$ on the interval $[-\pi/2,\pi/2]$, which is precisely what we just found. Thus, $f$ is completely determined (except at the pesky points $x=n\pi$, but as mentioned before, you can just pick some arbitrary value)