You might be wondering why they use cosine and not sine, here is reason.
It all depends on the starting point of the object under SHM.
If you start timing whilst the object it at a maximum, the graph made will be a cosine wave. (if timing starts at a minimum, it will be a -cosine wave).
Likewise, if timing starts at 0 displacement from the normal, it will be a sine wave. Whether the object then moves up or down from initial timing start will decipher whether it is a +sine or -sine.