# Solve the ordinary differential equation: \frac{dy}{dx}=\frac{x^2+xy+y^2}{x^2}

## Question:

Solve the ordinary differential equation:

{eq}\frac{dy}{dx}=\frac{x^2+xy+y^2}{x^2} {/eq}

## Differential Equations; Substitutions:

This differential equation expresses the derivative {eq}\frac{dy}{dx} {/eq} as a rational function in the variables {eq}x\text{ and y} {/eq}. We'll try a simple substitution

{eq}u=\text{some rational function in }x,y {/eq} to make this into a separable equation.

In this problem, the derivative {eq}\frac{dy}{dx} {/eq} is equal to a rational function in the variables {eq}x {/eq} and {eq}y {/eq}. We'll try the simple substitution {eq}u=\frac{y}{x} {/eq} to convert this differential equation into a separable one, noticing that

{eq}\frac{d\left( \frac{y}{x} \right)}{dx}=\frac{\frac{dy}{dx}}{x}-\frac{y}{x^2} {/eq}

We'll rewrite the differential equation {eq}\frac{dy}{dx}=\frac{x^2+xy+y^2}{x^2} {/eq} in an equivalent form:

{eq}\begin{align*} \frac{dy}{dx}&=\frac{x^2+xy+y^2}{x^2}&[\text{divide both sides by }x]\\ \frac{\frac{dy}{dx}}{x}&=\frac{x^2+xy+y^2}{x^3}&[\text{from both sides subtract }\frac{y}{x^2} ]\\ \frac{\frac{dy}{dx}}{x}-\frac{y}{x^2}&=\frac{x^2}{x^3}+\frac{y^2}{x^3}\\ \text{recalling that }\frac{d\left( \frac{y}{x} \right)}{dx}&=\frac{\frac{dy}{dx}}{x}-\frac{y}{x^2},\\ \text{we have:}&\\ \frac{d\left( \frac{y}{x} \right)}{dx}&=\frac{1}{x}+\frac{\left(\frac{y}{x}\right)^2}{x} \end{align*} {/eq}

So the original differential equation looks simpler in terms of the quotient {eq}\frac{y}{x} {/eq}. Thus, we use the substitution {eq}u=\frac{y}{x} {/eq} and the differential equation becomes:

{eq}\frac{d\left( u \right)}{dx}\left(=\frac{1}{x}+\frac{u^2}{x}\right)=\frac{1+u^2}{x}, {/eq}

which is a separable equation for it can be written as:

{eq}\frac{\frac{d\, u}{dx}}{1+u^2}=\frac{1}{x}. {/eq}

Integrating with respect to {eq}x {/eq} on both sides we get:

{eq}\begin{align*} \int \frac{\frac{d\, u}{dx}}{1+u^2}\;dx&=\int \frac{1}{x}\;dx\\ \int \frac{1}{1+u^2}\;du&=\ln|x|+C\\ \arctan(u)&=\ln|x|+C\\ \text{solving for }u,\\ u&=\tan\left(\ln|x|+C\right)\\ \text{return to the original function making }u&=\frac{y}{x},\\ \frac{y}{x}&=\tan\left(\ln|x|+C\right)\\ \text{solve for }y,\\ y&=x\,\tan\left(\ln|x|+C\right) \end{align*} {/eq}

Thus we can say that the family of solutions to the differential equation is:

{eq}\begin{align*} \boxed{y=x\,\tan\left(\ln|x|+C\right)}\\ \text{where }C\text{ is a real parameter.} \end{align*} {/eq}