I want to build a function $f(t)$. The function is simple but has some constraints:
- $t$ goes from $0$ to $1$
- $f(0) = 0$, $f(0.5) = 1$ and $f(1) = 0$
- $f$ is linear from $0$ to $0.5$ and from $0.5$ to $1$
How can I build such function?
What I thought: I started with $f(t) = -|t|$, then I added $1$, hence $f(t) = 1 - |t|$.
But I don't know how to drag this function.


The green line is the function you ended up with: $f(t) = 1-|t|$.
To transform it to the red function (so it is shrunk in half with respect to the y-axis), we set $g(t) = f(2t) = 1-|2t|$.
Finally to transform this to the blue function, we translate the graph to the right by $0.5$ units.
This is done by setting $h(t) = g(t-0.5) = 1-|2(t-0.5)| = 1-|2t-1|$.
Hence your function would be $h(t)$ defined on the interval $[0,1]$.