Let \(\displaystyle g\colon \mathbb{Z}\to\mathbb{N}\) be given by \(\displaystyle g(z)=2z\) if \(\displaystyle z\ge 0\) and \(\displaystyle g(z)=-2z-1\) if \(\displaystyle z<0\). What is \(\displaystyle g(-2)\)?
Step by step with comments, a check and common mistakes.
Step-by-step solution
Since \(\displaystyle -2\) is negative, the branch \(\displaystyle z<0\) applies.
\[\displaystyle z=-2<0\]
The formula for that branch is \(\displaystyle -2z-1\).