# Differential equation $\frac{dy}{dx}+\frac{2y}{x}=\frac{4}{x^2}$ (need help)

Find the general solution of the differential equation:

$$\frac{dy}{dx}+\frac{2y}{x}=\frac{4}{x^2}$$

$$\frac{dy}{dx}x^2+2xy=4\tag1$$

$$x^2+\int 2xydx=\int 4dx\tag2$$

$$x^2+yx^2=4x+c\tag3$$

$$y=\frac{4x+c}{x^2+1}\tag4$$

The answer from the book is $$y=\frac{4}{x}+\frac{c}{x^2}$$

• Where does the line $x^2+\int 2xy\,\mathrm{d}x=\int 4\,\mathrm{d}x$ come from? – user10354138 Jun 22 at 9:28
• The passage after $\frac{dy}{dx}x^2+2xy=4$ looks like nonsense – Saucy O'Path Jun 22 at 9:29
• I am trying to separate the variable but it is not working – user546244 Jun 22 at 9:31
• Seems like you were trying to integrate both sides, rather. – Saucy O'Path Jun 22 at 9:32
• With (1) write $(x^2y)'=4$. – Nosrati Jun 22 at 9:33

## 2 Answers

$$\frac{dy}{dx}+\frac{2y}{x}=\frac{4}{x^2}\qquad . . . . . . (1)$$

This is a first order linear differential equation.

Integrating factor (I.F.) is $$e^{\int \frac{2}{x} dx}=e^{2\log x}=x^2$$ So multiplying both side of $$(1)$$ by I.F. $$x^2\frac{dy}{dx}+2xy=4\implies \frac{d}{dx}(x^2y)=4$$ and then integrating$$x^2y=4x+c\implies y=\frac{4}{x}+\frac{c}{x^2}\qquad \text{where c is integrating constant.}$$

You can solve firstly the homogeneous differential equation.

$$\frac{dy}{dx}=-\frac{2y}{x}$$

$$\frac{dy}{y}=-\frac{2}{x}dx$$

$$\int \frac{dy}{y}=-\int\frac{2}{x}dx$$

$$\ln(y)=-2\cdot \ln(x)+c$$

$$\ln(y)=- \ln(x^2)+c$$

$$\ln(y)=\ln\left(\frac{1}{x^2}\right)+c$$

$$y_H=C\cdot \frac{1}{x^2}$$

Variation of the constant.

$$y_I=C(x)\cdot \frac{1}{x^2}$$

Differentiating (product rule)

$$y_I^{'}=C^{'}(x)\cdot \frac{1}{x^2}-C^{}(x)\cdot \frac{2}{x^3}$$

Plugging into the differential equation

$$C^{'}(x)\cdot \frac{1}{x^2}\underbrace{-C^{}(x)\cdot \frac{2}{x^3}+2\cdot C(x)\cdot \frac{1}{x^3}}_{=0}=\frac{4}{x^2}$$

$$C^{'}(x)\cdot \frac{1}{x^2}=\frac{4}{x^2}$$

$$C^{'}(x)=4\Rightarrow C(x)=4x$$

Thus the solution is $$y=y_H+y_I=C\cdot \frac{1}{x^2}+4x\cdot \frac{1}{x^2}$$

$$y=\frac{C}{x^2}+ \frac{4}{x}$$