Solving $\frac{\mathrm dy}{\mathrm dx}+\frac y{x^2}=\frac1{x^2}$ Solve the following equation:
$$
\dfrac {dy}{dx} + \dfrac {y}{x^2}=\dfrac {1}{x^2}
$$
My Attempt
Given:
$$
\dfrac {dy}{dx}+\dfrac {y}{x^2}=\dfrac {1}{x^2}
$$
Comparing above equation with the standard form of first order linear differential equation $dy/dx+P.y=Q$ where $P$ and $Q$ are the functions of $x$ or constants.
Now, using the integrating factor $e^{\int P dx}$:
$$
e^{\int P dx}=e^{\int x^{-2} dx}=e^{-\frac {1}{x}}
$$
Multiplying both sides of the given equation by integrating factor:
$$
e^{-\frac {1}{x}}.\dfrac {dy}{dx}+\dfrac {y.e^{-\frac {1}{x}}}{x^2}=\dfrac {e^{-\frac {1}{x}}}{x^2}
$$
 A: Hint: Write your equation in the form
$$\frac{dy}{1-y}=\frac{dx}{x^2}$$ for $$y\ne 1$$ and $$x\ne 0$$
A: Great, now write it in the form 
$$\frac{e^{-1/x}}{x^2}(y-1)\,dx + e^{-1/x} \,dy = 0$$
We are trying to find a function $F(x,y)$ such that the LHS above is the total differential of $F$.
Hence $$\frac{\partial F}{\partial y} = e^{-1/x}$$
$$\frac{\partial F}{\partial y} = \frac{e^{-1/x}}{x^2}(y-1)$$
Solving this we get e.g. $F(x,y) = e^{-1/x}(y-1)$.
Hence our equation is $$dF(x,y) = 0$$
so $F(x,y) = C$ for some $C \in \mathbb{R}$. We get
$$e^{-1/x}(y-1) = C \implies y = 1+Ce^{1/x}$$
A: I'll review the general solution from an integration factor. Let $R:=\exp\int Pdx$ so $R'=RP,\,(Ry)'=R(y'+Py)=RQ,\,y=R^{-1}\int RQdx$. In the special case $P=Q$, as in this problem, we in fact have $RQ=R'$ so $y=1+CR^{-1}$. As others have noted, $P=Q$ also makes the equation separable, viz. $dy/(1-y)=Pdx$ so $-\ln |1-y|=\ln R+C$, i.e. $|1-y|\propto R^{-1}$.
A: This is a linear DE so considering instead 
$$
x^2y'+y=1
$$
$$
y = y_h + y_p
$$
such that
$$
x^2y_h'+y_h = 0\\
x^2y_p' + y_p = 1
$$
for the homogeneous solution $y_h = C_0 e^{\frac 1x}$ which after substitution gives
$$
-C_0\frac{x^2}{x^2}e^{\frac 1x}+C_0 e^{\frac 1x}=0
$$
and for the particular $y_p = 1$ then
$$
y = C_0 e^{\frac 1x}+1
$$
