Problem with the solution of differential equation My try:



$\phantom{}\phantom{}\phantom{}$
Start by noticing that $P$ doesn't appear in the end result.  So,  we must eliminate it , instead of $Q$. Multiply by $y_2$  to the first and $y_1$ to the second and subtract to get 
$$y_2 \frac{dy_1}{dx}  - y_1 \frac{dy_2}{dx}  = Q(y_2-y_1) $$
Then substitute $y_2 = y_1*z$ and integrate it to get the answer.  Remember P and Q are functions of $x$. Your attempt shows that you forgot it while solving (integration part). 

Comment if you any more help.
Plugging $y_2$ in the equation,

$$y_1z'+y_1'z+Py_1z=Q$$ implies

$$y_1z'+Qz=Q$$

and

$$\frac{z'}{z-1}=-\frac{Q}{y_1},$$

$$\log(z-1)=\log a-\int\frac{Q}{y_1}dx.$$