Finding Area depending upon following condition Area bounded by $y=g(x), x$ -axis and the lines $x=-2,$
where $g(x)=\left\{\begin{array}{ll}\max \{f(t):-2 \leq t \leq x\}, & \text { where }-2 \leq x<0 \\ \min \{f(t): 0 \leq t \leq x\}, & \text { where } 0 \leq x \leq 3\end{array}\right.$
And ${f}(x)=x^2-|x|,$ is equal to
(a) $\frac{113}{24}$
(b) $\frac{111}{24}$
(c) $\frac{117}{24}$
(d) none
I have tried:
$$g(x)=\left\{\begin{array}{ll}2;\\ x^{2}-x ; & 0 \leq x \leq \frac{1}{2} \\ -\frac{1}{4} ; & \frac{1}{2}<x \leq 3\end{array}\right.$$
Required area: $$=\int_{-2}^0 2 \, dx + \int_0^{\frac{1}{2}} (x-x^2) \, dx + \int_{\frac{1}{2}}^3 \left(\frac{1}{4}\right) dx=\frac{113}{24} \text{ unit}^2$$
Correct me if I am wrong, also any other tricky approach is always welcome.
 A: Your answer is correct if:

*

*The area is also bounded by the line $x = 3$

*We are interested in the unsigned (absolute) area enclosed.

I think the most challenging part of the question is determining $g$.  For $-2 \le x < 0$, we must show that $$\max_{-2 \le t < x} t^2 - |t| = 2,$$ which we observe by noting that when $t < x < 0$, $f(t) = t^2 + t$, hence the global extrema occur at $f'(t) = 2t + 1 = 0$ or at an endpoint of the interval $[-2, x]$.  Moreover, if $x < -1/2$ the critical point $t = -1/2$ is not allowed and the global extremum is at $t = -2$.  If $-1/2 \le x < 0$, we have candidates $$t \in \{-2, -1/2, x\},$$ at which the function takes on values $$(t, f(t)) \in \{(-2, 2), (-1/2, -1/4), (x, x^2 + x)\}.$$  Again, the global maximum occurs at $t = -2$, so for all $-2 \le x < 0$, $g(x) = 2$.
Similarly, we consider the case where $1/2 \le x \le 3$ to find that the minimum occurs at $x = 1/2$, hence $g(x) = -1/4$ on this interval.  The trickiest part is when $0 \le x < 1/2$, in which case there are no critical points to $f(x) = x^2 - x$ on this interval, and the global minimum for $0 \le t \le x$ is attained at the variable right endpoint $t = x$.  All of this, put together, results in your piecewise function $$g(x) = \begin{cases} 2, & -2 \le x < 0 \\ x^2 - x, & 0 \le x \le 1/2 \\ -1/4, & 1/2 < x \le 3. \end{cases}$$
A: $f(-x)=x^{2}-|x|=f(x)$
Hence $x^{2}-|x| \quad$ is an even function.
For $x<0$
$f(x)=x^{2}+x$ (By symmetry we can plot the the total graph)
f(x) is a quadratic equation. whose vertex point will be ($\frac{-b}{2a},\frac{-d}{4a}$)

