# document.write (document.title)

 Math Help > Calculus > Differential Equations > Linear FODE

### Linear First Order Differential Equation: a(x) y' + b(x) y = c(x)

Note that this simplifies to y' + p(x) y = q(x), where p(x) = b(x)/a(x), and q(x) = c(x)/a(x), so from here on, we will solve only this form.

### Linear FODE: y' + p(x) y = q(x)

The general solution is given by

y = (∫u(x) q(x)dx + C)/u(x), where u(x) = e∫p(x)dx

Integrate p(x) to get u(x), then integrate the product u(x)q(x) to get y.  Then, if you are given an initial condition, you can use that to find C.

Example 1: y' = ax + by + c

Rewrite this as y' + (-b)y = ax+c, so p(x)=-b, and q(x)=ax+c.

u(x) = e∫p(x)dx = e∫-b dx = e-bx, so

y = (∫u(x) q(x)dx + C)/u(x),

y = (∫(e-bx)(ax+c)dx + C)/e-bx

y = (-abx-a-bc)/b2 + C/e-bx

y = (-a/b)x - (a+bc)/b2 + Cebx

If you are given an initial condition, you may use it to find C.

Example 2: ay' - y'x + y + b = 0

Rewrite this as (a-x)y' + y = -b, and then divide through by (a-x), giving

y' + (1/(a-x)) y = -b/(a-x), so p(x)=1/(a-x), and q(x) = -b/(a-x).

u(x) = e∫p(x)dx = e∫dx/(a-x) = e-ln(a-x) = 1/(a-x)

y = (∫u(x) q(x)dx + C)/u(x),

y = (∫-b dx / (a-x)2 + C)(a-x),

y = (-b/(a-x) + C)(a-x),

y = -b + C(a-x)

If you are given an initial condition, you may use it to find C.

Example 3: cot(x) y' + y = csc(x)

Multiply through by tan(x), giving

y' + tan(x) y = tan(x) csc(x), so p(x) = tan(x), and q(x) = tan(x) csc(x).

u(x) = e∫p(x)dx = e∫tan(x)dx = e-ln(cos(x)) = 1/cos(x) = sec(x)

y = (∫u(x) q(x)dx + C)/u(x),

y = (∫sec(x) tan(x) csc(x) dx + C)/sec(x),

y = (∫sec2(x) dx + C)/sec(x),

y = (tan(x)+C)/sec(x)

y = sin(x) + C cos(x)

Check it: y' = cos(x) - C sin(x).  Now, substitute y and y' in the left side of the original equation to get

cot(x) (cos(x) - C sin(x)) + sin(x) + C cos(x)
= cot(x) cos(x) - C cos(x) + sin(x) + C cos(x)
= cot(x) cos(x) + sin(x)
= (cos²(x) + sin²(x)) / sin(x)
= csc(x)

Success!

### Internet references

SOS Math: First Order Linear Equations

Math Reference Project: Differential Equations, Linear, First Order

### Related pages in this website

The webmaster and author of this Math Help site is Graeme McRae.