# Ordinary Differential Equations/Substitution 2

Substitution methods are really applicable anywhere you can find a differential equation. However, there's very few instances where you will always give a certain substitution. You generally pick one and plug it in as needed. So I'll give situations where you could use a substitution method, although you may later learn better methods.

## Parametric equations

One time where you may need it is when solving parametric equations. Lets say we're given functions for velocity in two dimensions- $v_x(t)$ and $v_y(t)$. If we want to solve for $y(x)$, you have to divide $\frac{v_y}{v_x}$. This works out to be $\frac{\frac{dv_y}{dx}}{\frac{dv_x}{dx}}=\frac{dy}{dx}$. When you do this, you will frequently (although not always) get a chance to use $\frac{y}{x}$ substitution.

### Constant velocity

Lets say we're swimming across a river with constant velocity $v_0$. The river has no current. We start swimming at an angle of $\theta$ with respect to the shore. Solve for $y(x)$

The first thing we need to do is break the velocity into x and y components. This is fairly simple.

$v_x=v_0cos(\theta)$
$v_y=v_0sin(\theta)$

Using simple trig, we can remove the theta.

$v_x=v_0\frac{x}{\sqrt{x^2+y^2}}$
$v_y=v_0\frac{y}{\sqrt{x^2+y^2}}$

Now we divide the two to find $\frac{dy}{dx}$.

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

Now this is simple to solve separably. It could also be solved via substituion. This is a trivial example, but it can be made more complicated.

### Motion against a current

Imagine the same swimmer. Now there is a current with speed r going straight up the river (positive y direction). How does this change our example?

The x component is still the same.

$\frac{dx}{dt}=v_0cos(\theta)=\frac{v_0x}{\sqrt{x^2+y^2}}$

And in the y direction we also have a term due to the current.

$\frac{dy}{dt}=v_0sin(\theta)+r=\frac{v_0y}{\sqrt{x^2+y^2}}+r$

You can get $\frac{dy}{dx}$ by dividing the two equations

$\frac{dy}{dx}=\frac{y}{x}+\frac{r\sqrt{x^2+y^2}}{v_0x}$

We can move the x into the root to simplify the equation a bit

$\frac{dy}{dx}=\frac{y}{x}+\frac{r\sqrt{\frac{x^2}{x^2}+\frac{y^2}{x^2}}}{v_0}$
$\frac{dy}{dx}=\frac{y}{x}+\frac{r}{v_0}\sqrt{1+\frac{y^2}{x^2}}$

Well, this complicated equation looks like a case for $\frac{y}{x}$ substitution.

$v=\frac{y}{x}$
$y=vx$
$y'=v+v'x$
$v+v'x=v+\frac{r}{v_0}\sqrt{1+v^2}$
$v'=\frac{r}{xv_0}\sqrt{1+v^2}$

That looks like a nice, easily solved separable equation. Let solve it.

$\frac{dv}{\sqrt{1+v^2}}=\frac{r}{xv_0}$
$\int \frac{dv}{\sqrt{1+v^2}}=\int \frac{r}{xv_0}$

The left end is an ugly integral. Just trust me on it.

$ln(v+\sqrt{1+v^2})=\frac{r}{v_0}ln(x)+C$
$v+\sqrt{1+v^2}=e^{ln(x^{\frac{r}{v_0}})+C}$
$v+\sqrt{1+v^2}=Cx^{\frac{r}{v_0}}$

Lets try to get rid of that root. Isolate it, and square both sides.

$\sqrt{1+v^2}=Cx^{\frac{r}{v_0}}-v$
$1+v^2=Cx^{2\frac{r}{v_0}}-2vCx^{\frac{r}{v_0}}+v^2$
$2vCx^{\frac{r}{v_0}}=C^2x^{2\frac{r}{v_0}}-1$
$v=\frac{Cx^{\frac{r}{v_0}}}{2}-\frac{1}{2Cx^{\frac{r}{v_0}}}$

Plugging in for v, we get

$\frac{y}{x}=\frac{Cx^{\frac{r}{v_0}}}{2}-\frac{1}{2Cx^{\frac{r}{v_0}}}$

We can solve for y by multiplying through by x

$y=\frac{Cx^{\frac{r}{v_0}+1}}{2}-\frac{x}{2Cx^{\frac{r}{v_0}}}$
$y=\frac{C}{2}x^{\frac{r}{v_0}+1}-\frac{1}{2C}x^{\frac{-r}{v_0}+1}$

This complicated equation does make sense- the bigger the current, the further you go in the y direction as a portion of the x.

If you ever find an equation this evil in real life, do yourself a favor and buy a computer program to solve it.