# Finding the area between two curves with Integrate

I'm trying to solve and approximate the area between the two graphs. Right now, my functions are stored as

f[x_] := 3 Sin[x]
g[x_] := x - 1


and then I tried to integrate by evaluating

Integrate[Abs[f[x] - g[x]], x]


Instead of getting an answer, I just get the exact same thing I inputted

Integrate[Abs[f[x] - g[x]], x]


How do I fix this?

• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find this meta Q&A helpful Apr 12 '19 at 2:35

Use Assumptions:

Integrate[Abs[f[x] - g[x]], x, Assumptions -> x \[Element] Reals] Or try RealAbs instead of Abs:

Integrate[RealAbs[f[x] - g[x]], x] (They are equivalent antiderivatives.)

To get the area between the graphs, you need also to solve for the points of intersection.

area = Integrate[
Abs[f[x] - g[x]], {x, Sequence @@ MinMax[x /. Solve[f[x] == g[x], x, Reals]]}] The area is approximately:

N[area]
(*  5.57475  *)

• RealAbs is awesome to know about! :O Apr 12 '19 at 2:40

You need to add assumptions, like this

 Integrate[Abs[f[x] - g[x]], x, Assumptions :> Element[x, Reals]] f[x_] := 3 Sin[x]

Integrate[Sqrt[(f[x] - g[x])^2], x]