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.
Related Questions in ORDINARY-DIFFERENTIAL-EQUATIONS
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.