- #1

- 12

- 0

## Homework Statement

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) = ?

## Homework Equations

None

## 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.