User:Jiangpx/6321 hw5

Given
$$\begin{align} & L2-ODE-VC \\ & {{x}^{2}}y''-2xy'+2y=0 \\ & with-Boundary-conditions \\ & y(1)=-2 \\ & y(2)=5 \\ \end{align}$$

Find
The solution using the method of trial solution

Solution
Let trial solution $$y(x)={{x}^{r}}$$, with r constant.

Then

$$\begin{align} & y'=r{{x}^{r-1}} \\ & y''=r(r-1){{x}^{r-2}} \\ \end{align}$$

Substitution yields

$$\begin{align} & r(r-1)-2r+2=0 \\ & {{r}^{2}}-3r+2=0 \\ & (r-1)(r-2)=0 \\ & {{r}_{1}}=1\cdots {{r}_{2}}=2 \\ \end{align}$$

Hence the general solution is

$$y(x)={{c}_{1}}x+{{c}_{2}}{{x}^{2}}$$

With the given boundary conditions, we get

$$\begin{align} & {{c}_{1}}+{{c}_{2}}=-2 \\ & 2{{c}_{1}}+4{{c}_{2}}=5 \\ \end{align}$$

Solving this gives c1=-6.5 and c2=4.5, therefore the solution of this BVP is

$$y(x)=-6.5x+4.5{{x}^{2}}$$

Given
$$\begin{align} & y'+P(x)y=Q(x) \\ & {{y}_{h}}=A\exp [-\int{P(x)dx}] \\ \end{align}$$

Find
$${{y}_{p}}$$ by variation of parameters

Solution
Let

$$y(x)=u(x)\cdot {{y}_{h}}(x)=u(x)\cdot \exp [-\int{P(x)dx}]$$

Then

$$\begin{align} & y'=-u(x)P(x)\exp [-\int{P(x)dx}]+u'(x)\exp [-\int{P(x)dx}] \\ & =\exp [-\int{P(x)dx}]\cdot (u'(x)-u(x)P(x)) \\ \end{align}$$

Substitution gives

$$\begin{align} & \exp [-\int{P(x)dx}]\cdot (u'(x)-u(x)P(x))+P(x)u(x)\exp [-\int{P(x)dx}]=Q(x) \\ & {{y}_{h}}(u'(x)-u(x)P(x)+u(x)P(x))=Q(x) \\ & {{y}_{h}}\cdot u'(x)=Q(x) \\ & u'(x)=y_{h}^{-1}\cdot Q(x)=\exp [\int{P(x)dx}]\cdot Q(x) \\ & u(x)=\int{\exp [\int{P(x)dx}]\cdot Q(x)dx} \\ \end{align}$$

Therefore, the particular solution is

$$y(x)=\exp [-\int{P(x)dx}]\cdot \int{\exp [\int{P(x)dx}]\cdot Q(x)dx}$$

Given
Characteristic Roots $$\begin{align} & {{r}_{1}}=2 \\ & {{r}_{2}}=\frac{1}{1+x} \\ \end{align}$$

and differential equation $$\left( x+1 \right)y''-\left( 2x+3 \right)y'+2y=0$$

Find
Two homogeneous solutions u1(x) and u2(x)

Solution
Let trial solution be $$y={{e}^{rx}}$$,  with r1=2 given we have

$${{u}_{1}}(x)=\exp (2x)$$

According to lecture notes $${{u}_{2}}(x)={{u}_{1}}(x)\int{\frac{1}{{{u}_{1}}^{2}}\cdot \exp (-\int{{{a}_{1}}(x)dx)dx}}$$

with

$${{a}_{1}}(x)=-\frac{2x+3}{x+1}$$

u2 becomes

$$\begin{align} & {{u}_{2}}(x)=\exp (2x)\cdot \int{\exp (-4x)\cdot \exp (\int{\frac{2x+3}{x+1}dx)dx}} \\ & {{u}_{2}}(x)=\exp (2x)\cdot \int{\exp (-4x)\cdot \exp (2x+\log (x+1))dx} \\ & {{u}_{2}}(x)=\exp (2x)\cdot \int{\exp (-4x)\cdot \exp (2x)\cdot (x+1)dx} \\ & {{u}_{2}}(x)=\exp (2x)\cdot \int{\exp (-2x)\cdot (x+1)dx} \\ & {{u}_{2}}(x)=\exp (2x)\cdot \exp (-2x)\cdot \frac{-(2x+3)}{4} \\ & {{u}_{2}}(x)=\frac{-(2x+3)}{4}\to 2x+3 \\ \end{align}$$

Note: (-1/4), as a constant, can be ignored.

With

$$\begin{align} & {{u}_{1}}(x)=\exp (2x)--(1) \\ & {{u}_{2}}(x)=2x+3--(2) \\ \end{align}$$

The homogeneuous solution is

$$y(x)={{c}_{1}}{{e}^{2x}}+{{c}_{2}}(2x+3)$$

Alternatives:

To find u2(x), assume $${{u}_{2}}''=0$$,  then we have to solve

$$(2x+3)y'=2y$$

It is kinda easy to get

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

So

$$\log (y)=\log (2x+3)$$

i.e.,

$${{u}_{2}}(x)=y=(2x+3)$$

Therefore, the homogeneuous solution is

$$y(x)={{c}_{1}}{{e}^{2x}}+{{c}_{2}}(2x+3)$$

Given
Trail solution y(x)=exp(r*x)/x^2 and char.eq. r^2+3=0

Find
The associated differential equation

Solution
Find the derivatives using Matlab

$$\begin{align} & y=\frac{\exp (rx)} \\ & y'=\frac{\exp (rx)}\cdot (r-\frac{2}{x}) \\ & y''=\frac{\exp (rx)}\cdot ({{r}^{2}}-\frac{4}{x}r+\frac{6}) \\ \end{align}$$

Substitution and compare with characteristic equation gives

$$\frac{\exp (rx)}\cdot \left[ {{a}_{2}}({{r}^{2}}-\frac{4}{x}r+\frac{6})+{{a}_{1}}(r-\frac{2}{x})+{{a}_{0}} \right]=\frac{\exp (rx)}\cdot ({{r}^{2}}+3)=0$$

Expanding terms results

$${{r}^{2}}({{a}_{2}})+r(\frac{-4{{a}_{2}}}{x}+{{a}_{1}})+(\frac{6{{a}_{2}}}-\frac{2{{a}_{1}}}{x}+{{a}_{0}})={{r}^{2}}(1)+r(0)+3$$

Solve for a2, a1 and a0

$$\begin{align} & {{a}_{2}}=1 \\ & {{a}_{1}}=\frac{4}{x} \\ & {{a}_{0}}=\frac{3{{x}^{2}}+2} \\ \end{align}$$

Therefore, the differential equation is

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

or can be written in the form of

$${{x}^{2}}y''+4xy'+(3{{x}^{2}}+2)y=0$$

The solution can be deduced from the roots of characteristic equation

$$\begin{align} & {{r}_{1}}=i\sqrt{3} \\ & {{r}_{2}}=-i\sqrt{3} \\ \end{align}$$

Then

$$\begin{align} & y={{c}_{1}}\frac{\exp (i\sqrt{3}x)}+{{c}_{2}}\frac{\exp (-i\sqrt{3}x)} \\ or \\ & y={{k}_{1}}\frac{\cos (\sqrt{3}x)}+{{k}_{1}}\frac{\sin (\sqrt{3}x)} \\ \end{align}$$ where c1, c2, k1 and k2 are integration constants.

Matlab code for derivatives and final solution: This verifies our solution.

Given
$$\begin{array}{*{35}{l}} {} & {{u}_{2}}(x)={{u}_{1}}(x)\int{\frac{dx}{h(x)}}-(1) \\ {} & {{y}_{p}}(x)={{u}_{1}}(x)\int{\frac{1}{h(x)}}\left( \int{h(x)\frac{f(x)}{{{u}_{1}}(x)}dx} \right)dx-(2) \\ \end{array}$$

and

$$\begin{align} & {{y}_{p}}(x)=\int\limits_{x}{f(s)\left\{ \frac{{{u}_{1}}(s){{u}_{2}}(x)-{{u}_{1}}(x){{u}_{2}}(s)}{W(s)} \right\}ds}(3)\\ & W(s)={{u}_{1}}(s){{u}_{2}}'(s)-{{u}_{2}}(s)u{}_{1}'(s)(4)\\ \end{align}$$

Find
To show that the expressions for Yp is equivalent

Solution
Write (3) in follows,

$${{y}_{p}}(x)={{u}_{2}}(x)\int\limits_{x}{\frac{f(s){{u}_{1}}(s)}{W(s)}}ds-{{u}_{1}}(x)\int\limits_{x}{\frac{f(s){{u}_{2}}(s)}{W(s)}}ds---(5)$$

According to (1),

$${{\left( \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)} \right)}^{\prime }}=\frac{1}{h(x)}--(6)$$

Differentiation rules shows that

$${{\left( \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)} \right)}^{\prime }}=\frac{{{u}_{1}}{{u}_{2}}'-{{u}_{2}}{{u}_{1}}'}{{{u}_{1}}^{2}}-(7)$$

Along with (4) we can get

$$\frac{1}{W}=\frac{h}{{{u}_{1}}^{2}}---(8)$$

Therefore (5) becomes,

$$\begin{align} & {{y}_{p}}(x)={{u}_{1}}(x)\left( \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)}\cdot \int\limits_{x}{\frac{f(s){{u}_{1}}(s)}{W(s)}}ds-\int\limits_{x}{\frac{f(s){{u}_{2}}(s)}{W(s)}}ds \right) \\ & {{y}_{p}}(x)={{u}_{1}}(x)\left( \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)}\cdot \int\limits_{x}{\frac{f(s){{u}_{1}}(s)h(s)}{{{u}_{1}}^{2}(s)}}ds-\int\limits_{x}{\frac{f(s){{u}_{2}}(s)h(s)}{{{u}_{1}}^{2}(s)}}ds \right) \\ & {{y}_{p}}(x)={{u}_{1}}(x)\left( \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)}\cdot \int\limits_{x}{\frac{h(s)f(s)ds}{{{u}_{1}}(s)}}-\int\limits_{x}{\frac{f(s){{u}_{2}}(s)h(s)}{{{u}_{1}}^{2}(s)}}ds \right)(9) \\ \end{align}$$

Integration by parts for (2)

$$\begin{array}{*{35}{l}} {} & {{y}_{p}}(x)={{u}_{1}}(x)\cdot \left\{ \left( \int{h(x)\frac{f(x)}{{{u}_{1}}(x)}dx} \right)\cdot \left( \int{\frac{dx}{h(x)}} \right)-\left( \int{\left( \int{\frac{dx}{h(x)}} \right)\cdot h(x)\frac{f(x)}{{{u}_{1}}(x)}dx} \right) \right\} \\ {} & \begin{align} & {{y}_{p}}(x)={{u}_{1}}(x)\cdot \left\{ \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)}\left( \int{h(x)\frac{f(x)}{{{u}_{1}}(x)}dx} \right)-\int{\frac{{{u}_{2}}(x)}{{{u}_{1}}(x)}\cdot h(x)\frac{f(x)}{{{u}_{1}}(x)}dx} \right\} \\ & {{y}_{p}}(x)={{u}_{1}}(x)\cdot \left\{ \frac{{{u}_{2}}(x)}{{{u}_{1}}(x)}\left( \int{\frac{h(x)f(x)}{{{u}_{1}}(x)}dx} \right)-\int{\frac{h(x)f(x){{u}_{2}}(x)}{{{u}_{1}}^{2}(x)}dx} \right\}--(10) \\ \end{align} \\ \end{array}$$

Comparing (9) and (10) -- They are equivalent