Solution of differential equation $\frac{dy}{dx}+Py=Q$ If $\ y_1$ and $\ y_2$ be the solution of the differential equation $\frac{dy}{dx}+Py=Q$ where P and Q are the function of x alone and  $\ y_2=z\ y_1$, then prove that $z=1+ae^{{-\int\frac{Qdx}{y}}}$, where a is being an arbitrary constant.
My approach is as follow
Step 1:  $\ y_2-\ y_1=z(\ y_1-1)$
Step 2:  $\frac{dy_1}{dx}+Py_1=Q$ &$\frac{dy_2}{dx}+Py_2=Q$
Step 3:  $\frac{dy_2}{dx}-\frac{dy_1}{dx}=z\frac{dy_1}{dx}$
Step 4:  $\frac{dy_2}{dx}-\frac{dy_1}{dx}+P(\ y_2-\ y_1)=0$ or $\frac{dy_2}{dx}-\frac{dy_1}{dx}+Pz(\ y_1-1)=0$
Step 5:  $z\frac{dy_1}{dx}+Pz(\ y_1-1)=0$
AFter this step I am confused
 A: A rather terse presentation:
$y_2 = zy_1; \; y_i' + Py_i = Q, \; i = 1, 2; \tag 0$
$y_2' = z'y_1 + zy_1'; \tag 1$
$y_2' + Py_2 = z'y_1 + zy_1' + Pzy_1 = z'y_1 + z(y_1' + Py_1); \tag 2$
$Q = z'y_1 + zQ; \tag 3$
$z' + \dfrac{Q}{y_1} z = \dfrac{Q}{y_1}; \tag 4$
$(e^{\int \frac{Q}{y_1} dx}) z' + 
(e^{\int \frac{Q}{y_1} dx})  \dfrac{Q}{y_1} z =  (e^{\int \frac{Q}{y_1} dx}) \dfrac{Q}{y_1}; \tag{4.5}$
$(e^{\int \frac{Q}{y_1} dx} z)' = (e^{\int \frac{Q}{y_1} dx}) \dfrac{Q}{y_1} = (e^{\int \frac{Q}{y_1} dx})'; \tag 5$
$e^{\int \frac{Q}{y_1} dx} z + C_1 = 
e^{\int \frac{Q}{y_1} dx} + C_2; \tag 6$
$e^{\int \frac{Q}{y_1} dx} z = 
e^{\int \frac{Q}{y_1} dx} + C_2 - C_1; \tag 7$
$a = C_2 - C_1; \tag 8$
$e^{\int \frac{Q}{y_1} dx} z = 
e^{\int \frac{Q}{y_1} dx} + a; \tag 9$
$z = 1 + ae^{-\int \frac{Q}{y_1} dx}. \tag{10}$
Note Added in Edit, Saturday 20 October 2018 12:15 PM PST:  We may in fact discover more details about the function $z(x)$ and the constant $a$ by intercepting the stream of the preceding argument at (4.5) and replacing the indefinite integrals with more concrete calculations, performing definite integrations over the interval $[x_0, x]$:
$\left (\exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) z'(x) + \left (\exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) \dfrac{Q(x)}{y_1(x)} z(x)$
$= \left ( \exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) \dfrac{Q(x)}{y_1(x)}; \tag{11}$
$\left ( \left (\exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) z(x) \right )' = \left ( \exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right) \right )'; \tag{12}$
$\left (\exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) z(x) - z(x_0)$
$= \displaystyle \int_{x_0}^x \left ( \left (\exp \left (\displaystyle \int_{x_0}^u \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) z(u) \right )' \; du = \int_{x_0}^x \left ( \exp \left ( \int_{x_0}^u \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right )' \; du$
$= \exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) - 1; \tag{13}$
$\left (\exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) z(x)= \exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) + z(x_0) - 1, \tag{14}$
or, with
$a = z(x_0) - 1, \tag{15}$
$\left (\exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) \right ) z(x)= \exp \left (\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ) + a, \tag{16}$
and therefore,
$z(x) = 1 + a  \exp \left (-\displaystyle \int_{x_0}^x \dfrac{Q(s)}{y_1(s)} \; ds \right ), \tag{17}$
the more specific form of (10).  End of Note.
A: Hint: Here's another way. Suppose $y_1 = zy_2$, then
\begin{align}
y_1'+Py_1 = Q \ \ \implies& \ \ z'y_2+zy_2'+zPy_2=(zy_2)'+P(zy_2) = Q\\
\implies&\ \ z'y_2+z(y_2'+Py_2) = Q\\
\implies&\ \ z'+qz = q
\end{align}
where $q = Q/y_2$.
