1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Solving a Linear Piecewise ODE

  1. Sep 4, 2012 #1
    1. The problem statement, all variables and given/known data
    Solve the piecewise linear ODE, y' - y = f(x), y(0) = 1, where
    f(x) = 1 when 0<=x<=1 and f(x) = -1 when x > 1.

    y(2) = ?

    2. Relevant equations

    3. The attempt at a solution
    I found the integrating factor to be e^-x and multiplied both sides of the equation by the integrating factor.

    I rewrote the equation as the d/dx(e^-x * y) = e^-x * f(x). I integrated both sides to get e^-x * y = -e^-x * f(x) + C.

    Solving for y, I got y = -f(x) + C/e^-x. Using the initial value y(0)=1, I managed to find C as +2. Solving for y(2) there onwards, I obtained an answer of 15.7781, which was said to be the wrong answer. I am not sure where I went wrong!

    I would appreciate any help on solving this problem using the "5 Steps Method" aka the basic method for solving an inhomogeneous linear DE.
  2. jcsd
  3. Sep 4, 2012 #2
    You have two different differential equations. Try solving first in the range 0<x<1 for y(1) and then use this as an initial condition for the second equation to find y(2).
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook