TITLE: How did we discover the method of solving the linear 1st order ODE?
QUESTION [5 upvotes]: I have the first order linear ode in the standard form which I'd like to solve:
$ \frac{d y}{d x}+P(x) y=f(x) $
The solution in the book I'm reading (A First Course in Differential Equations with Modeling Applications by Dennis Zill 10th edition) is as follow:

The method for solving the differential equation above hinges on a
  remarkable fact that the left hand side of the equation can be recast
  into the form of the exact derivative of a product by multiplying both
  sides of the equation by a special function $\mu(x)$. It is relatively
  easy to find the function $\mu(x)$ because we want:
$ \frac{d}{d x}[\mu(x) y]=\mu \frac{d y}{d x}+\frac{d \mu}{d x} y=\mu\frac{d y}{d x}+\mu P y $
The equality is true provided that:
$\frac{d \mu}{d x}=\mu P$
The last equation can be solved by separation of variables.
  Integrating
$\frac{d \mu}{\mu}=P d x \quad \text { and solving } \quad \ln|\mu(x)|=\int P(x) d x+c_{1}$
gives $\mu(x)=c_{2} e^{\int P(x) d x}$. Even though there are an
  infinite choices of $\mu(x)$ (all constant multiples of $e^{\int P(x) d x}$), all produce the same desired result. Hence we can simplify
  life and choose $c_{2}=1$. 
The function $\mu(x)=e^{\int P(x) d x}$ is called an integrating
  factor for the differential equation.
Here is what we have so far: We multiplied both sides of the DE by the
  integrating factor and, by construction, the left-hand side is the
  derivative of a product of the integrating factor and y:
$\begin{aligned} e^{\int P(x) d x} \frac{d y}{d x}+P(x) e^{\int P(x) d x} y &=e^{\int P(x) d x} f(x) \\ \frac{d}{d x}\left[e^{\int P(x) d x} y\right] &=e^{\int P(x) d x} f(x) \end{aligned}$
Finally, we discover why $\mu(x)$ is called an integrating factor. We
  can integrate both sides of the last equation,
$e^{\int P(x) d x} y=\int e^{\int P(x) d x} f(x)+c$
and solve for y. The result is a one-parameter family of solutions of
  the DE:
$y=e^{-\int P(x) d x} \int e^{\int P(x) d x} f(x) d x+c e^{-\int P(x) d x}$

I have a few points that I couldn't understand in this method:

"The method for solving the differential equation above hinges on a remarkable fact that the left hand side of the equation can be recast into the form of the exact derivative of a product by multiplying both sides of the equation by a special function $\mu(x)$". Where did this fact come from and why?
Was this method done by construction? It wasn't clear to me how could this method be discovered for the first time, like is it intuitive? What should you have in mind in order to do the construction done in this proof? i.e. what was the motivation to multiply the DE by $\mu(x)$ ?

In summary, I did not understand the first few steps of this proof and why we chose to do it that way.
In practice, while solving linear DE using this method we tend to multiply the whole equation by $\mu(x)$ and then set the left hand side of the DE equal to $ \frac{d}{d x}[\mu(x) y]$,  and then find the solution. So I want to know why we do that procedure in the first place.
P.S: It would be nice if you can give me a little bit of history about who developed this method and when did he do it.

REPLY [4 votes]: I did not understand the first few steps of this proof and why we chose to do it that way.
I believe that it is helpful to see this method as a generalization of a very simple reasoning, as explained below.

Problem 1: Solve $\frac{d y}{d x}=0$.
Solution: From the Mean Value Theorem we known that "zero derivative implies constant function". Therefore,
\begin{align*}
&\frac{d y}{d x}=0\\
&y=c \quad(\text{constant})
\end{align*}
Problem 2: Solve $\frac{d y}{d x}+1=0$.
Solution: Clearly, the left-hand side is the derivative of $y+x$ (this is the smart trick). Therefore, we can reduce this problem to the previous one:
\begin{align*}
&\frac{d y}{d x}+1=0\\
&\frac{d}{d x}(y+x)=0\\
&y+x=c \quad(\text{by Problem 1})\\
&y=-x+c
\end{align*}
This strategy seems promising. In fact, it works with $1$ replaced by any function $f(x)$ whose antiderivative $F(x)$ is known. For example:
\begin{align*}
&\frac{d y}{d x}+x^2+e^x=0\\
&\frac{d}{d x}(y+\tfrac{x^3}{3}+e^x)=0\\
&y+\tfrac{x^3}{3}+e^x=c\\
&y=-\tfrac{x^3}{3}-e^x+c
\end{align*}
Let us try something more complicated.
Problem 3: Solve $x\frac{d y}{d x}+y=0$.
Solution: Inspired by the above solutions, we would like to write the left-hand side as a derivative. In this case, it is not obvious how to do that. We want to write a sum as a derivative. Do we have a tool that relates a derivative with a sum? Yes, the product rule: 
$$\frac{d}{dx}(\mu(x)\cdot y(x))=\mu(x)\cdot \frac{d}{dx}(y(x))+\frac{d}{dx}(\mu(x))\cdot y(x)\tag{$*$}$$
If we think a little, we realize that we can write the left-hand side of our equation as the right-hand side of $(*)$ by taking $\mu(x)=x$. Therefore, the previous method can be applied:
\begin{align*}
&x\frac{d y}{d x}+y=0\\
&x\cdot \frac{d y}{d x}+1\cdot y=0\\
&x\cdot \frac{d y}{d x}+\frac{d}{dx}(x)\cdot y=0\\
&\frac{d}{d x}(xy)=0\quad(\text{by the product rule})\\
&xy=c\\
&y=\frac{c}{x}
\end{align*}

As a generalization of this idea, given an equation of the form
  $$\frac{dy}{dx}+P(x)y=f(x),$$
  we want to find $\mu(x)$ such that the left-hand side takes the form $\frac{d}{dx}(\mu(x)y)$. Does there exist such $\mu(x)$? Yes: it is called integrating factor and given by $\mu(x)=e^{\int P(x) dx}$.