This is homogeneous so we only need the complementary solution.
The most common approach which is to go straight to the "characteristic equation", which here is:
lambda^2 + 4 lambda + 5 = 0λ2+4λ+5=0
And which has complex roots:
lambda_(1,2) = (-4 pm sqrt ( 4^2 - 4(5) ))/(2) = - 2 pm iλ1,2=−4±√42−4(5)2=−2±i
The solution to this equation is therefore:
y = A e^((-2 + i )x) + B e^((-2 - i )x)y=Ae(−2+i)x+Be(−2−i)x
= e^(-2x) (A e^( i x) + B e^( - i) x)=e−2x(Aeix+Be−ix)
Using Euler's Formula, e^(i theta) = cos theta + i sin thetaeiθ=cosθ+isinθ, we can expand this to:
= e^(-2x) (A (cos x + i sin x) + B (cos x - i sin x ))=e−2x(A(cosx+isinx)+B(cosx−isinx))
= e^(-2x) ( (A+B) cos x + i (A-B) sin x)=e−2x((A+B)cosx+i(A−B)sinx)
And then simplify with new integration constants:
= e^(-2x) ( C cos x + D sin x)=e−2x(Ccosx+Dsinx)
We can now apply the IV's:
y(0) = 2 implies 2 = (1) ( C + D (0)) implies C = 2y(0)=2⇒2=(1)(C+D(0))⇒C=2
We then have:
y = e^(-2x) ( 2 cos x + D sin x)y=e−2x(2cosx+Dsinx)
So by the product rule:
y' = -2e^(-2x) ( 2 cos x + D sin x) + e^(-2x) ( - 2 sin x + D cos x)
= e^(-2x)( ( -4 + D)cos x - (2D + 2) sin x)
Applying the other IV:
y'(0) = -7 implies -7 = (1)((-4+D) - (2D+2)(0) )
implies D = -3
implies y = e^(-2x) ( 2 cos x - 3 sin x)