<s>[INST] Finding a formula for a function using the 2nd fundamental theorem of calculus $$f(t) =\begin{cases}  t &\text{if }0 \leq t \leq 1, \\
 2-t &\text{if }1 < t \leq 2, \\
t^2 &\text{if }t > 2. 
\end{cases}$$
Find a formula for the function $F: [0, 2] \rightarrow \mathbb{R}$ defined by $F(x) = \int_0^xf(t)\mathrm dt$ for x $\geq$ 0
Working:
For $0 \leq  t \leq 1$:
\begin{align*}
F(x) &= \int_{0}^xf(t)\mathrm dt\\
&= \int_{0}^x t\mathrm dt\\
&= \left[\frac{1}{2} t^2\right]^x_{0}\\
&= \frac{1}{2}x^2 
\end{align*}
I'm confused from that point onwards - ie. how to find the second bit. My teacher broke up the integrand (I understand that bit) but then I think she used $F(1)$ for the first part of the integrand. I don't really understand why she picked $1$ in particular.
Also, two queries:

*

*Does the way you apply the 2nd Fundamental Theorem change depending on if you are dealing with $<$ vs. $\leq$


*My teacher said, for $0 \leq t \leq 1$, let $g(t) = \frac{1}{2}t^2$ so $g'(t) = f(t)$ but I don't really see why the Fundamental Theorem helps much except by making things more confusing.
 [/INST] Your given function is given piecewise.
$$ f(t) = \begin{cases}
t ,& 0 \leq t \leq 1  \\
2-t ,& 1 < t \leq 2  \\
t^2 ,& 2 < t
\end{cases}  $$
You should expect your accumulation function to also be given piecewise.
\begin{align*}
F(x) &= \int_0^x f(t) \,\mathrm{d}t  \\
    &= \begin{cases}
\int_0^x f(t) \,\mathrm{d}t &, 0 \leq x \leq 1  \\  
\int_0^1 f(t) \,\mathrm{d}t + \int_1^x f(t) \,\mathrm{d}t &, 1 < x \leq 2  \\
\int_0^1 f(t) \,\mathrm{d}t + \int_1^2 f(t) \,\mathrm{d}t + \int_2^x f(t) \,\mathrm{d}t &, 2 < x  \\
\end{cases}
\end{align*}
(When $x$ is in $[0,1]$, we only need to know the first piece of $f$ to get the accumulation from $0$ to $x$.  When $x$ is in $(1,2]$, we first accumulate from $0$ to $1$ using the first piece of $f$, then from $1$ to $x$ using the second piece.  When $x > 2$, we fully accumulate on $[0,1]$ and on $(1,2]$ then as much of the third piece as needed to reach $x$.)
\begin{align*}
    &= \begin{cases}
\int_0^x t \,\mathrm{d}t &, 0 \leq x \leq 1  \\  
\int_0^1 t \,\mathrm{d}t + \int_1^x (2-t) \,\mathrm{d}t &, 1 < x \leq 2  \\
\int_0^1 t \,\mathrm{d}t + \int_1^2 (2-t) \,\mathrm{d}t + \int_2^x t^2 \,\mathrm{d}t &, 2 < x  \\
\end{cases}  \\
    &= \begin{cases}
\left.\frac{t^2}{2} \right|_{t=0}^x &, 0 \leq x \leq 1  \\  
\left. \frac{t^2}{2} \right|_{t=0}^1 + \left. (2t-\frac{t^2}{2})\right|_{t=1}^{x} &, 1 < x \leq 2  \\
\left. \frac{t^2}{2} \right|_{t=0}^1 + \left. (2t-\frac{t^2}{2})\right|_{t=1}^{2} + \left. \frac{t^3}{3} \right|_{t=2}^x &, 2 < x   \\
\end{cases}  \\
&= \begin{cases}
\frac{x^2}{2} - 0 &, 0 \leq x \leq 1  \\  
\frac{1}{2} - 0 + \left( 2x-\frac{x^2}{2} \right) - \left( 2-\frac{1}{2} \right) &, 1 < x \leq 2  \\
\frac{1}{2} - 0 + (4-2) - (2-\frac{1}{2}) + \frac{x^3}{3} - \frac{8}{3} &, 2 < x   \\
\end{cases}  \\
&= \begin{cases}
\frac{x^2}{2} &, 0 \leq x \leq 1  \\  
-1 + 2x - \frac{x^2}{2} &, 1 < x \leq 2  \\
\frac{x^3 - 5}{3} &, 2 < x   \\
\end{cases}
\end{align*}
(A check:  This is an accumulation, so we expect the first two pieces to glue together continuously at $x = 1$.  Both are continuous so we can evaluate the limit (from the left) of the first piece by specializing $x \mapsto 1$, obtaining $1/2$.  Similarly specializing in the second piece, we obtain $-1+2- 1/2 = 1/2$.  So the two pieces do match at $x = 1$.  Checking again at $x = 2$, the second and third pieces meet at height $1$.)
</s>