# Thread: Integrating with absolute value?

1. ## Integrating with absolute value?

Integrating with absolute value?

Let f(a) = int 0 to 2 |x(x-a)|dx for 0<=a<=2
find the function f(a)

The solution says to separate it into two integrals from 0 to a then to a to 2. Then take the negative of both then add? I don't get it. Why do you have to take the negative of each? Please explain!

2. \displaystyle \displaystyle \begin{align*}|x(x - a)| &= |x^2 - ax|\\&= \left|x^2 - ax + \left(-\frac{a}{2}\right)^2 - \left(-\frac{a}{2}\right)^2\right|\\&= \left|\left(x - \frac{a}{2}\right)^2 - \frac{a^2}{4}\right|\end{align*}

Note that $\displaystyle \displaystyle \left|\left(x - \frac{a}{2}\right)^2 - \frac{a^2}{4}\right| = \left(x - \frac{a}{2}\right)^2 - \frac{a^2}{4}$ when $\displaystyle \displaystyle \left(x - \frac{a}{2}\right)^2 - \frac{a^2}{4} \geq 0$ and $\displaystyle \displaystyle \left|\left(x - \frac{a}{2}\right)^2 - \frac{a^2}{4}\right| = \frac{a^2}{4} - \left(x - \frac{a}{2}\right)^2$ when $\displaystyle \displaystyle \left(x - \frac{a}{2}\right)^2 - \frac{a^2}{4} < 0$.

Can you go from here?

3. Though I do get your algebra, i'm still wondering about how to get to the final equation.

I'm trying to understand more about how the equation goes about. Because we can tell that if x<a then it positive, and if a>x it is negative. And how do you translate this into equation form?

The solution for this problem (on the answer sheet) is

f(a) = -$\displaystyle \int$(from 0 to a) $\displaystyle x(x-a)dx -$$\displaystyle \int$ from(a to 2) $\displaystyle x(x-a)dx$

I'm trying to understand why is it negative for both terms :/

4. Originally Posted by gundanium
Integrating with absolute value?

Let f(a) = int 0 to 2 |x(x-a)|dx for 0<=a<=2
find the function f(a)
The solution says to separate it into two integrals from 0 to a then to a to 2. Then take the negative of both then add? I don't get it. Why do you have to take the negative of each? Please explain!
I think that is sentence in red is mistaken.
Note that $\displaystyle \left| {x(x - a)} \right| = \left\{ {\begin{array}{*{20}c} {x(a - x),} & {0 \leqslant x \leqslant a} \\ {x(x - a),} & {a \leqslant x \leqslant 2} \\ \end{array} } \right.$

Thus we have:
$\displaystyle \int_0^2 {\left| {x(x - a)} \right|dx} = \int_0^a {x(a - x)dx} + \int_a^2 {x(x - a)dx}$

5. YES! This is what I mean ) I see what you did there with the 0<=x<=a THANK you!