# Math Help - A Linear Equation; IVP; Piecewise Defined Funciton

1. ## A Linear Equation; IVP; Piecewise Defined Funciton

$\frac{dy}{dx}+2xy=f(x)$ such that $y(0)=2$

$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 $e^{\int 2xdx}=e^{x^2}$, so:

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

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

The point $(0,2)$ gives:

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

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

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

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

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

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

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

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

Problem: The solution in the book gives $\left(\frac{1}{2}e+\frac{3}{2}\right)e^{-x^2}$ for $x \geq 1$ and I don't see how to find C_4 because the point $(0,2)$ isn't on the interval $[1,\infty)$

2. 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 x \geq 1$ (and it would probably have been easier, since you already had it).

3. 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 $y=Ce^{-x^2}$ is a solution for any value of C, and basically they have $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 $0\leq x \leq 1$ and $x>0$. The you can say:

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

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

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

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

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