Find the general solution for each of the following differential equations. x \frac{d y}{d x}-y=x+1
Find the general solution for each of the following differential equations. x \frac{d y}{d x}-y=x+1

Solution:

x \frac{d y}{d x}-y=x+1\dots \dots (1)
To solve (1) we will use following formula
\begin{array}{l} \int \frac{1}{x} d x=\log x \\ \int x^{n} d x=\frac{x^{n+1}}{n+1}+c \\ a \log b=\log b^{a} \\ a^{\log _{a} b}=\log b \end{array}
General solution for the differential equation in the form of
\frac{d y}{d x}+P y=Q
General solution is given by,
y \cdot(I . F .)=\int Q \cdot(I . F .) d x+c
Where, integrating factor,
e \int^{P d x}
Dividing equation (1) by x,
\frac{d y}{d x}-\frac{1}{x} \cdot y=\frac{x+1}{x} \ldots \ldots \ldots(2)
Comparing (2) with
\frac{d y}{d x}+P y=Q
Where, P=\frac{-1}{x} and Q=\frac{x+1}{x}
Therefore, integrating factor is
\begin{aligned} \text { I.F. }=e \int^{-1 / x d x}=e \int^{P d x} & \\ e^{-\log x}-&\left(\int \frac{1}{x} d x=\log x\right) \\ e^{\log \frac{1}{x}}-&\left(a \log b=\log b^{a}\right) \\ \frac{1}{x}-&\left(a^{\log _{a} b}=\log b\right) \end{aligned}
General solution is
\begin{array}{r} y \cdot(I . F .)=\int Q \cdot(I . F .) d x+c \\ y \cdot\left(\frac{1}{x}\right)=\int\left(\frac{x+1}{x}\right) \cdot\left(\frac{1}{x}\right) \\ \begin{array}{l} \frac{y}{x}=\int\left(\frac{x^{2}+1}{x}\right) \mathrm{d} x+\mathrm{C} \\ \frac{y}{x}=\int\left(\frac{1}{x}+\frac{1}{x^{2}}\right) \mathrm{d} \mathrm{x}+\mathrm{c} \\ \frac{y}{x}=\log x+\frac{x^{-1}}{-1}+c_{-1}^{n} d x=\frac{x^{n+1}}{n+1}+\mathrm{c} \int x^{n} d x=\frac{x^{n+1}}{n+1}+c \\ \frac{y}{x}=\log x-\frac{1}{\mathrm{x}}+\mathrm{c} \end{array} \end{array}
Multiplying above equation by x,
y=x \log x-1+c x