That's one way.
It can also be done this way (but this is much more "mathematically sophisticated")
sin(x) and cos(x) are solutions to the differential equation y"= - y with the properties that cos(0)= 1, cos'(0)= 0, sin(0)= 1, sin'(0)= 1 so it can be shown that any solution to y"= -y with y(0)= A, y'(0)= B must be of the form y= Acos(x)+ Bsin(x).
Let y(x)= sin(x+ h) where h is a constant. Then y'(x)= cos(x+ h) and y"= -sin(x+h)= -y. This function y satisfies the differential equation. Also y(0)= sin(0+h)= sin(h) and y'(0)= cos(x+ h)= cos(x). Therefore, y(x)= sin(x+h)= sin(h)cos(x)+ cos(h)sin(x).
You can also let y(x)= cos(x+h). Then y'(x)= -sin(x+h) and y"(x)= -cos(x+h)= -y.
y(0)= cos(h) and y'(0)= -sin(h). Therefore y(x)= cos(x+h)= cos(h)cos(x)- sin(h)sin(x).