[Math] How to Prove if Two Functions are Equal

discrete mathematicsfunctions

My question is how do you determine if two functions are indeed equal. I know $f$ and $g$ will be equal if $f(x) = g(x)$, but how do you determine that for all $x$ values? One could graph to get a good idea, but that still that may only mean they are equal for the $x$ values for the portion of the graph seen and not for all $x$ values.

So for functions like the ones below, it's particularly easy to determine if they are equal just by looking at them, but how do you PROVE they are equal?

$$f: \Bbb Z \rightarrow \Bbb Z, \text{ where } f(x) = x^2$$

$$g: \Bbb Z \rightarrow \Bbb Z, \text{ where } f(x) = \left |x \right |^2$$

Or, for instance, here is another example:

$$f: \Bbb R \times \Bbb R \rightarrow \Bbb R, \text{ where } f(x,y) = \left | x+y \right |$$

$$g: \Bbb R \times \Bbb R \rightarrow \Bbb R, \text{ where } g(x,y) = \left | x \right | +\left | y \right |$$

Again, how do you prove they are equal?

Any advice would be helpful. Thank you so much!

Best Answer

Going on what lulu has said - For the first case, use proof by contradiction and assume that $\exists k \in \mathbb{Z}$ such that $f(k) \neq g(k)$. Using the definitions of $f$ and $g$:

$$k^2 \neq |k|^2$$

If the two terms are not equal, then the difference between the two is nonzero, or $k^2 - |k|^2 \neq 0$. The expression on the left hand side of the inequality can be factored such that

$$(k - |k|)(k + |k|)$$ must be nonzero. By the definition of absolute value, you will find that this expression can never be nonzero for all $k \in \mathbb{Z}$. Thus, by contradiction, $f(x) = g(x)$ for all $x \in \mathbb{Z}$.