Answer: \(y=\mathrm{e}^x(9x-4)-2\sin x\).
We solve
\(\displaystyle \frac{\mathrm{d}^2y}{\mathrm{d}x^2}-2\frac{\mathrm{d}y}{\mathrm{d}x}+y=4\cos x\),
with \(y=-4\) and \(\dfrac{\mathrm{d}y}{\mathrm{d}x}=3\) when \(x=0\).
First solve the homogeneous equation
\(y''-2y'+y=0\).
Its auxiliary equation is
\(m^2-2m+1=0\),
so \((m-1)^2=0\).
This gives a repeated root \(m=1\), so the complementary function is
\(y_c=\mathrm{e}^x(Ax+B)\).
For a particular solution, try
\(y_p=p\sin x+q\cos x\).
Then
\(y_p'=p\cos x-q\sin x\),
\(y_p''=-p\sin x-q\cos x\).
Substitute into the differential equation:
\((-p\sin x-q\cos x)-2(p\cos x-q\sin x)+(p\sin x+q\cos x)=4\cos x\).
Collecting coefficients gives
\(2q\sin x-2p\cos x=4\cos x\).
So
\(2q=0\Rightarrow q=0\),
\(-2p=4\Rightarrow p=-2\).
Hence
\(y_p=-2\sin x\).
So the general solution is
\(y=\mathrm{e}^x(Ax+B)-2\sin x\).
Differentiate:
\(y'=A\mathrm{e}^x+\mathrm{e}^x(Ax+B)-2\cos x\).
Now use the initial conditions.
At \(x=0\),
\(y(0)=B=-4\), so \(B=-4\).
Also
\(y'(0)=A+B-2=3\).
Substituting \(B=-4\):
\(A-6=3\Rightarrow A=9\).
Therefore the required particular solution is
\(\boxed{y=\mathrm{e}^x(9x-4)-2\sin x}.\)