We have to evaluate the piecewise defined function
![g(x)=\mleft\{\begin{aligned}-2\text{ }if\text{ x<-2} \\ (x-1)^2-2\text{ if -2}\leq x\leq2 \\ -(1)/(2)x+2\text{ if x>2}\end{aligned}\mright.](https://img.qammunity.org/2023/formulas/mathematics/college/bjj6689d39yeduqciixpz3xwmjtg78lw19.png)
to evaluate this type of function we have to be careful to choose the right relation for the number we are evaluating.
Let's do the first one
![g(-2)](https://img.qammunity.org/2023/formulas/mathematics/college/irrruk5gr4vxfazbnjn973fqxy9qguyis5.png)
Since the -2 lies in the second interval of the function we have to choose the second relation in the function, then
![\begin{gathered} g(-2)=(-2-1)^2-2 \\ =(-3)^2-2 \\ =9-2 \\ =7 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/c5zo9i09jq2lu04qy0og3x7pi92esepxzh.png)
therefore g(-2)=7.
To evaluate g(0) we notice that x=0 also lies in the second interval of the piecewise function. Then
![\begin{gathered} g(0)=(0-1)^2-2 \\ =(-1)^2-2 \\ =1-2 \\ =-1 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/id0yr488e89wcla7zmsyb6z0g5ohkdz86m.png)
therefore g(0)=-1.
Finally, to evaluate g(5) we notice that x=5 lies in the third interval of the function, then
![\begin{gathered} g(5)=-(1)/(2)(5)+2 \\ =-(5)/(2)+2 \\ =-(1)/(2) \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/8gvwf2grsddpdc9csrhtc7ya9wi4x53h4r.png)
Therefore g(5)=-1/2.