Sine/Cosine Subtraction Formulas The differential equation $\frac{d^2 y}{dt^2}+ \omega^2 y=0$ has the general solution $y = A\cos (\omega t)+ B\sin (\omega t)$. Also given are the initial values: $y(a) = A, y'(a) = B$.
I tried:
$$y(a) = A\cos(\omega a) + B\sin(\omega a )= A$$
$$y'(a) = −\omega A\sin(\omega a) + \omega B\cos(\omega a)= B$$
And then substituted $A$ and $B$ into the general solution: 
$$y = (A\cos(\omega a) + B\sin(\omega a))\cosωt + \omega (−A\sin(\omega a) + B\cos(\omega a))\sin(\omega t)$$
From here I can't get it to work. I want to simplify and express y with the subtraction formulas. 
The answer is $y = A\cos(\omega (t−a)) + \frac{B}{\omega}\sin(\omega (t−a))$
I know how the formulas work, But I can't figure out how $\frac{B}{\omega}$ got there.
Please help, I'm stuck.

It is unfortunate that you used the letters $A$ and $B$ for two different sets of variables, first for the undetermined coefficients in the solution and then for the prescribed initial values. 
If you remove the second use, you get
\begin{align}
y(a)&=A\cos(ωa)+B\sin(ωa),\\
\frac{y'(a)}{ω}&=−A\sin(ωa)+B\cos(ωa).
\end{align}
The right side is a rotation of the vector $\pmatrix{A\\B}$ by the angle $ωa$, so you can reverse it by a rotation by $-ωa$,
\begin{align}
A&=y(a)\cos(ωa)-\frac{y'(a)}{ω}\sin(ωa),\\
B&=y(a)\sin(ωa)+\frac{y'(a)}{ω}\cos(ωa).
\end{align}
Inserting that should lead directly to the trigonometric subtraction formulas.

As the differential equation is homogeneous, the family of the solutions is invariant under time shifts. Thus you could have from the start used
$$
y(x)=A\cos(ω(x-a))+B\sin(ω(x-a)),
$$
as the form of the general solution. Then it would follow immediatly that $y(a)=A$ and $y'(a)=ωB$.
