# What is a solution to the differential equation dy/dx=(2y+x^2)/x?

Oct 2, 2016

$y \left(x\right) = \left(C + {\log}_{e} \left(x\right)\right) {x}^{2}$

#### Explanation:

This is a linear differential equation. Its solution can be composed of the homogeneous solution (${y}_{h} \left(x\right)$) plus a particular solution (${y}_{p} \left(x\right)$) so

$y \left(x\right) = {y}_{h} \left(x\right) + {y}_{p} \left(x\right)$

The homogeneous solution obeys

$\frac{{\mathrm{dy}}_{h}}{\mathrm{dx}} - \frac{2}{x} {y}_{h} \left(x\right) = 0$. Here, clearly the solution is

${y}_{h} \left(x\right) = C {x}^{2}$

By grouping variables:
${\mathrm{dy}}_{h} / \left({y}_{h}\right) = 2 \frac{\mathrm{dx}}{x} \to \ln {y}_{h} = {C}_{1} \ln {x}^{2} \to {y}_{h} = C {x}^{2}$

The determination of ${y}_{p} \left(x\right)$ must obey

$\frac{{\mathrm{dy}}_{p}}{\mathrm{dx}} - \frac{2}{x} {y}_{p} \left(x\right) = x$.

To solve this, we will use a technique due to Lagrange
(https://en.wikipedia.org/wiki/Joseph-Louis_de_Lagrange)

called the constant variation technique.

We will suppose that ${y}_{p} \left(x\right) = c \left(x\right) {y}_{h} \left(x\right)$. Substituting we obtain

y_h(x)(dc(x))/(dx) + c(x) ((dy_h(x))/(dx)-(2 y_h(x))/x) = x or

${y}_{h} \left(x\right) \frac{\mathrm{dc} \left(x\right)}{\mathrm{dx}} = x$ so

$\frac{\mathrm{dc} \left(x\right)}{\mathrm{dx}} = \frac{x}{{y}_{h} \left(x\right)} = \frac{x}{{x}^{2}} = \frac{1}{x}$ so

$c \left(x\right) = {\log}_{e} x$ and finally

$y \left(x\right) = C {x}^{2} + {\log}_{e} \left(x\right) {x}^{2} = \left(C + {\log}_{e} \left(x\right)\right) {x}^{2}$

Oct 3, 2016

$y = {x}^{2} \left(\ln x + C\right)$

#### Explanation:

Alternative Approach

$y ' = \frac{2 y + {x}^{2}}{x} = 2 \frac{y}{x} + x$

$y ' - \frac{2}{x} y = x$

This is exact if we times it by a factor of $\frac{1}{x} ^ 2$ [See below for mechanical process to find that factor]

$\frac{1}{x} ^ 2 y ' - \frac{2}{x} ^ 3 y = \frac{1}{x}$

ie
$\left(\frac{1}{x} ^ 2 y\right) ' = \frac{1}{x}$

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

$y = {x}^{2} \left(\ln x + C\right)$

Integrating Factor
We can extract the "integrating factor" $\eta \left(x\right)$ for the DE in form $y ' \textcolor{red}{- \frac{2}{x}} y = x$ as:

$\eta = \exp \left(\int \textcolor{red}{- \frac{2}{x}} \mathrm{dx}\right)$

$= {e}^{- 2 \ln x}$

$= \frac{1}{x} ^ 2$