Question:

The function $f$ is linear in stretches and is given for $0 \leq t \leq 6$ of the figure. Sketch the integral

$$S(x) = \int_ {0}^{x} f(t)~dt$$

for $0 \leq x \leq 6$. Also write down a formula for $S(x)$.

Attempted solution:

My general approach here is to write down the function for $f(t)$ in the different parts i.e. split it up into three linear functions. Then I integral these and then plot those functions.

Function between $x = 0$ and $x = 1$:

$$f(x) = 2x$$

The integral is:

$$F(x) = x^2 + C_{1}$$

Function between $x = 1$ and $x = 5$:

$$f(x) = -x + 3$$

The $m$ value is 3 because it would cross the y-axis there. The integral becomes:

$$F(X) = -\frac{x^2}{2} + 3x + C_{2}$$

Function between $x = 5$ and $x = 6$ is:

$$f(x) = -2$$

with the integral:

$$F(x) = -2x + C_{3}$$

However, this is not the formal for $S(x)$. Instead, the three expected parts of $S(x)$ are:

$$x^2,~~ 0 \leq x \leq 1$$ $$\frac{6x – x^2 -3}{2},~~ 1 \leq x \leq 5$$ $$11 -2x,~~ 5 \leq x \leq 6$$

I suspect the key here is to figure out the values of the integral constants.

I have tried calculating the different constants (such as $C_1$) by evaluating the integral of that particular region (such as 0 to 1) and setting it equal to the area under the graph, but the integration constants cancel out and are equal for all values of the constant.

How can I wrap this question up? I am mostly interesting in understanding how to get to the formula, as I can draw that without much effort once I have it.