We will encounter piecewise defined functions in differential equations when we think about some physical phenomenon. For example, we might consider the vibration of an airplane wing that is struck by some external object or a circuit that is initially open and then we close the circuit and the current immediately starts flowing. Both of these scenarios would require a piecewise defined function because there is a moment in time when something about the physical system changes.
If we want to evaluate the function at a particular \(t\)-value, we use the restrictions on the right to point us to which piece of the function definition we should use. For example, if we want to know \(g(3)\text{,}\) then we look over at that right side and see that 3 falls into the interval \(2 \le t \lt 6,\) so we use the corresponding function, \(-t+1\text{.}\) Thus, \(g(3) = -3 + 1 = -2.\)
If we want to graph, we also use those restrictions. When \(t \lt 1\text{,}\) or equivalently when \(t\) is in the interval \((-\infty, 1),\) we know that the graph of \(g\) will look like the horizontal line \(y=0\text{;}\) on the interval \([1, 2),\) the graph will look like the graph of the parabola \(y = t^2\text{;}\) etc.
In the plots below you can see the entire graphs of the functions, dotted, with a solid segment that will be part of the piecewise function \(g\text{.}\)