# A Linear Equation; IVP; Piecewise Defined Funciton

• Jan 23rd 2011, 10:44 AM
A Linear Equation; IVP; Piecewise Defined Funciton
$\displaystyle \frac{dy}{dx}+2xy=f(x)$ such that $\displaystyle y(0)=2$

$\displaystyle f(x)=\left\{\begin{array}{cc} x, &\mbox { if } 0\leq x< 1\\ 0,&\mbox { if } x\geq 1\end{array}\right$

The integrating factor is $\displaystyle e^{\int 2xdx}=e^{x^2}$, so:

$\displaystyle \int\frac{d}{dx}\left[e^{x^2}y\right]dx=\int xe^{x^2}dx$

$\displaystyle e^{x^2}y=\frac{1}{2}e^{x^2}+C_1$

The point $\displaystyle (0,2)$ gives:

$\displaystyle C_1=\frac{3}{2}$

$\displaystyle y=\frac{1}{2}+\frac{3}{2e^{x^2}}$

For $\displaystyle x\geq 1$ the equation is separable.

$\displaystyle \frac{dy}{dx}=-2xy$

$\displaystyle \int \frac{1}{y}\frac{dy}{dx}dx=-\int 2x dx=-x^2+C_2$

$\displaystyle ln\mid y\mid =-x^2+C_3$

$\displaystyle \mid y \mid = C_4e^{-x^2}$

$\displaystyle y=\pm C_4e^{-x^2}$

Problem: The solution in the book gives $\displaystyle \left(\frac{1}{2}e+\frac{3}{2}\right)e^{-x^2}$ for $\displaystyle x \geq 1$ and I don't see how to find C_4 because the point $\displaystyle (0,2)$ isn't on the interval $\displaystyle [1,\infty)$
• Jan 23rd 2011, 03:31 PM
Prove It
Your solution looks fine, I don't see how they could have done that either.

On a side note, you could also have used the Integrating Factor method with $\displaystyle \displaystyle x \geq 1$ (and it would probably have been easier, since you already had it).
• Jan 24th 2011, 11:47 AM
Quote:

Originally Posted by Prove It
Your solution looks fine, I don't see how they could have done that either.

Yeah, the family of functions $\displaystyle y=Ce^{-x^2}$ is a solution for any value of C, and basically they have $\displaystyle C=\frac{1}{2}e+\frac{3}{2}$ which is a constant. The problem is that you can't get to this value...

It turns out that this constant makes the piecewise defined solution continous at x=1 if you change the original intervals to $\displaystyle 0\leq x \leq 1$ and $\displaystyle x>0$. The you can say:

$\displaystyle lim_{x->1}Ce^{-x^2}=y(1)=\frac{1}{2}+\frac{3}{2e^{(1)^2}}=\frac{1 }{2}+\frac{3}{2e}$

$\displaystyle lim_{x->1}Ce^{-x^2}=\frac{C}{e}$

$\displaystyle \frac{C}{e}=\frac{1}{2}+\frac{3}{2e}$

$\displaystyle C=\frac{1}{2}e+\frac{3}{2}$

However, this isn't correct because $\displaystyle y(1)\neq \frac{1}{2}+\frac{3}{2e}$ on the original interval. But I'm pretty sure I see their mistake now.