User:Egm6321.f10.team2.patterson/Homework 4

= Problem 1: Show Exactness of Second Order Linear Ordinary Differential Equations with Varying Coefficients (L2_ODE_VC) =

Given
For the following equation:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

F\left(x,y,y',y\right)=\left(cos x \right)y+\left(x^{2}-sin x\right)y'+ 2xy=0

$$ (eq 1.1)
 * 
 * }

(1) Show that Eq. 1.1 is exact

(2) Find the first integral,Φ, and

(3) Solve for y(x)

(1) Proof of Exactness
To be exact, the equation must satisfy two conditions.

1st Condition of Exactness
First, the equation must be presented in the following format
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

F\left(x,y,y',y\right)=g\left(x,y,y'\right)+f\left(x,y,y'\right)y

$$ (eq 1.2) By letting y' = p, the first condition of exactness is satisfied as shown in the following equation:
 * 
 * }


 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

F\left(x,y,p,y\right)=\underbrace{\left(x^{2}-sin x \right)p+ 2xy}_{g\left(x,y,p\right)}+\underbrace{\left(cos x \right)}_{f\left(x,y,p\right)}y

$$

(eq 1.3)
 * 
 * }

2nd Condition of Exactness
In order to meet the second condition of exactness, the following equations must be satisfied:


 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

f_{xx}+2pf_{xy}+p^{2}f_{yy}=g_{xp}+pg_{yp}-g_{y}

$$

(eq 1.4)
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

f_{xp}+pf_{yp}+2f_{y}=g_{pp}

$$

(eq 1.5) Each element of equations 1.4 and 1.5 are calculated to be the following:
 * 
 * }


 * {| style="width:100%" border="0"

$$ \displaystyle f_{xx}=-cos\left(x\right)$$
 * style="width:95%" |
 * style="width:95%" |

$$\displaystyle f_{xy}=f_{yy}=f_{y}=f_{xp}=f_{yp}=0$$

$$\displaystyle g_{xp}=2x-cos\left(x\right)$$

$$\displaystyle g_{y}=2x$$

$$\displaystyle g_{yp}=g_{pp}=0 $$


 * 
 * }

Plugging each relevant element into equation 1.4 yields the following:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

-cos\left(x\right)+2p\cancel{f_{xy}}^{0}+p^{2}\cancel{f_{yy}}^{0}=2x-cos\left(x\right)+p\cancel{g_{yp}}^{0}-2x $$

$$-cos\left(x\right)=-cos\left(x\right)$$ (eq 1.6)
 * 
 * }

Plugging each relevant element into equation 1.5 yields the following:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\cancel{f_{xp}}^{0}+p\cancel{f_{yp}}^{0}+2\cancel{f_{y}}^{0}=\cancel{g_{pp}}^{0} $$

$$ \displaystyle 0=0$$ (eq 1.7) Equations 1.4 and 1.5 have been satisfied and therefore the equation is exact.
 * 
 * }

(2) Solving for the First Integral,Φ
The first integral is defined by the following:


 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\phi=h\left(x,y\right)+\underbrace{\int \underbrace{f\left(x,y,p\right)}_{cos\left(x\right)}\,dp}_{pcos\left(x\right)}

$$

(eq 1.8)
 * 
 * }

From equation 1.8 the following equations can be derived:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\phi_{x}=h_{x}+	\frac{\partial}{\partial x}\left[pcos\left(x\right)\right]=h_{x}-psin\left(x\right)

$$

(eq 1.9)
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\phi_{y}=h_{y}+	\frac{\partial}{\partial y}\left[pcos\left(x\right)\right]=h_{y}

$$

(eq 1.10) Using the definition of g to solve for h, yields the following:
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

g\left(x,y,p\right)=\phi_{y}p+\phi_{x}=h_{y}p+\left[h_{x}-psin\left(x\right)\right]

$$

$$g\left(x,y,p\right)=\left[h_{y}-sin\left(x\right)\right]p+h_{x}$$

(eq 1.11) By equating equation 1.11 with the g(x,y,p) shown in equation 1.3, the partial derivatives of h can be solved as shown:
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\left[h_{y}-sin\left(x\right)\right]p+h_{x}=\left[x^{2}-sin\left(x\right)\right]p+2xy $$ (eq 1.12)
 * 
 * }
 * {| style="width:100%" border="0"

$$\displaystyle h_{y}=x^{2}$$ (eq 1.13)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$\displaystyle h_{x}=2xy$$
 * style="width:95%" |
 * style="width:95%" |

(eq 1.14) Next, equations 1.13 and 1.14 can be integrated separately to solve for h(x,y) as follows:
 * 
 * }
 * {| style="width:100%" border="0"

$$\displaystyle h=\int h_{x}\,dx +w\left(y\right)=x^{2}y+ w\left(y\right)$$
 * style="width:95%" |
 * style="width:95%" |

(eq 1.15)
 * 
 * }
 * {| style="width:100%" border="0"

$$\displaystyle h=\int h_{y}\,dy +v\left(x\right)=x^{2}y+ v\left(x\right)$$
 * style="width:95%" |
 * style="width:95%" |

(eq 1.16)
 * <p style="text-align:right">
 * }

Equating equations 1.15 and 1.16 show that
 * {| style="width:100%" border="0"

$$\displaystyle h=x^{2}y$$ (eq 1.17) Therefore, equation 1.8 can be rewritten as:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\phi=x^{2}y+pcos\left(x\right)+k_{1}

$$

(eq 1.18)
 * <p style="text-align:right">
 * }

(3) Solving for y(x)
When combined with the definition of the first integral:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\phi=k_{2} $$

(eq 1.19)
 * <p style="text-align:right">
 * }

Equation 1.18 can be rewritten as:


 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\phi=x^{2}y+cos\left(x\right)y'=K $$

Where $$\displaystyle K=k_{2}-k_{1}$$ (eq 1.20) The equation is divided by cos(x) in order to find an integrating factor:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

y'+\frac{x^{2}}{cos\left(x\right)}y=\frac{K}{cos\left(x\right)} $$

(eq 1.21)
 * <p style="text-align:right">
 * }

Multiply the entire equation by $$e^{\int \frac{x^{2}}{cos(x)}\,dx}$$ yields:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

e^{\int \frac{x^{2}}{cos(x)}\,dx}y'+\frac{x^{2}}{cos\left(x\right)}e^{\int \frac{x^{2}}{cos(x)}\,dx}y=e^{\int \frac{x^{2}}{cos(x)}\,dx}\frac{K}{cos\left(x\right)} $$

(eq 1.22) The left hand side of the equation can be condensed to the following:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

(e^{\int \frac{x^{2}}{cos(x)}\,dx}y)'=e^{\int \frac{x^{2}}{cos(x)}\,dx}\frac{K}{cos\left(x\right)} $$

(eq 1.23) Integrating both sides with respect to x gives:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

e^{\int \frac{x^{2}}{cos(x)}\,dx}y=K\int e^{\int \frac{x^{2}}{cos(x)}\,dx}\frac{1}{cos\left(x\right)}\,dx $$

(eq 1.24) Dividing both sides by $$e^{\int \frac{x^{2}}{cos(x)}\,dx}$$ yields the solution for y:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

y=Ke^{-\int \frac{x^{2}}{cos(x)}\,dx}\int e^{\int \frac{x^{2}}{cos(x)}\,dx}\frac{1}{cos\left(x\right)}\,dx $$

(eq 1.25)
 * <p style="text-align:right">
 * }