Why is my solution to $ \frac{d^2y}{dx^2} - 2\frac{dy}{dx} + 5y = 10\sin x $ wrong? This is what I did to find out the general solution :-
$$ (D^2 - 2D + 5)y = 10\sin x \\ 
\therefore \text{Auxiliary equation is } m^2 - 2m + 5 = 0 \\
\rightarrow m = \frac{-(-2) \pm \sqrt{(-2)^2 - 4.1.5}}{2.1} \\
= \frac{2 \pm \sqrt{4 - 20}}{2} \\
= \frac{2 \pm 4i}{2} = 1 \pm 2i \\
\therefore \text{Complementary function = } e^x(C_1\cos 2x + C_2 \sin 2x) \\
\text{Now, particular integral } = \frac{10 \sin x}{D^2 - 2D + 5} \\
= \frac{10 \sin x}{-1^2 -2D + 5} = \frac{10 \sin x}{4 - 2D} = \frac{5 \sin x}{2 - D} \\
= \frac{5\sin x}{2(1-\frac{D}{2})} = \frac{5}{2}\left(1-\frac{D}{2}\right)^{-1}\sin x \\ 
= \frac{5}{2}\left(1 + \frac{D}{2} + ...\right)\sin x \\
= \frac{5}{2}\left(\sin x + \frac{D}{2}\sin x\right) = \frac{5}{2}\left(\sin x + \frac{\cos x}{2}\right) = \frac{5}{4}(2\sin x + \cos x) \\
\text{Now, } y = \text{CF + PI} \\
\therefore y = e^x(C_1\cos 2x + C_2 \sin 2x) + \frac{5}{4}(2\sin x + \cos x) $$
But the answer given in the book is :-
$$ y = e^x(C_1 \cos 2x + C_2 \sin 2x) + 2 \sin x + \cos x $$

Here's how to get the right answer with your method.
After you render
$PI=10(1-\dfrac{D}{2})^{-1}(\sin x)$
you then apply a difference of squares factorization to get
$(1-\dfrac{D}{2})^{-1})=(1+\dfrac{D}{2})(1-\dfrac{D^2}{4})^{-1}$
and then observe that when $D$ operates on $\sin x$ then $D^2=-1$.  So
$(1-\dfrac{D}{2})^{-1}=(1+\dfrac{D}{2})(1+\dfrac{1}{4})^{-1}=\color{blue}{\dfrac{4}{5}}(1+\dfrac{D}{2})$
thus getting the factor of $4/5$ you missed.
