[Math] How to add piecewise functions with different domains

functions

I have two piecewise functions:
$$
f(x) = \begin{cases} 2 \qquad x > 2 \\
3 \qquad x <2
\end{cases}
$$
$$
g(x) = \begin{cases} -2 \qquad x \ge 2 \\
2 \qquad x <2
\end{cases}
$$

I need to calculate $g(x) – f(x)$ but I don't understand what happens at $x = 2$ as only $g(x)$ is defined there.

Best Answer

Split it into cases.

For $x<2,$ $f(x)=3$ and $g(x)=2$ so $g(x)-f(x)=-1$ for $x<2.$

At $x=2$ $f(x)$ doesn't exist so $g(x)-f(x)$ is undefined here.

For $x>2$ it's just $-2-2=-4.$