Answer: \(y=\frac{3}{10}\sin x-\frac{1}{10}\cos x+\frac{11}{10}e^{-3x}\).
We solve the linear differential equation
\(\frac{dy}{dx}+3y=\sin x\).
The integrating factor is
\(e^{\int 3\,dx}=e^{3x}\).
Multiplying the equation by \(e^{3x}\) gives
\(e^{3x}\frac{dy}{dx}+3e^{3x}y=e^{3x}\sin x\),
so
\(\frac{d}{dx}(ye^{3x})=e^{3x}\sin x\).
Integrating,
\(ye^{3x}=\int e^{3x}\sin x\,dx+C\).
Let \(I=\int e^{3x}\sin x\,dx\).
Using integration by parts,
\(I=-e^{3x}\cos x+3\int e^{3x}\cos x\,dx\).
Let \(J=\int e^{3x}\cos x\,dx\). Then, again by parts,
\(J=e^{3x}\sin x-3\int e^{3x}\sin x\,dx=e^{3x}\sin x-3I\).
Substituting into the expression for \(I\),
\(I=-e^{3x}\cos x+3(e^{3x}\sin x-3I)\).
So
\(I=-e^{3x}\cos x+3e^{3x}\sin x-9I\),
hence
\(10I=e^{3x}(3\sin x-\cos x)\).
Therefore
\(I=\frac{1}{10}e^{3x}(3\sin x-\cos x)\).
So
\(ye^{3x}=\frac{1}{10}e^{3x}(3\sin x-\cos x)+C\).
Dividing by \(e^{3x}\),
\(y=\frac{3}{10}\sin x-\frac{1}{10}\cos x+Ce^{-3x}\).
Using \(y=1\) when \(x=0\),
\(1=\frac{3}{10}\sin 0-\frac{1}{10}\cos 0+C\)
\(1=-\frac{1}{10}+C\).
So \(C=\frac{11}{10}\).
Hence
\(y=\frac{3}{10}\sin x-\frac{1}{10}\cos x+\frac{11}{10}e^{-3x}\).