Area Between Curves 6A6E58
1. **Problem Statement for Q9:** Find the area between the piecewise function $$f(x) = \begin{cases} x^2 & 0 \leq x \leq 1 \\ 2 - x & 1 < x \leq 2 \end{cases}$$ and $$g(x) = x$$ over the interval $$[0,2]$$.
2. **Formula and Approach:** The area between two curves $$f(x)$$ and $$g(x)$$ over an interval $$[a,b]$$ is given by $$\int_a^b |f(x) - g(x)| \, dx$$.
3. **Step-by-step for Q9:**
- For $$0 \leq x \leq 1$$, $$f(x) = x^2$$ and $$g(x) = x$$.
- Compute $$f(x) - g(x) = x^2 - x = x(x-1)$$.
- Since $$x \in [0,1]$$, $$x-1 \leq 0$$, so $$x^2 - x \leq 0$$, meaning $$g(x) \geq f(x)$$ here.
- Area on $$[0,1]$$ is $$\int_0^1 (x - x^2) \, dx$$.
- For $$1 < x \leq 2$$, $$f(x) = 2 - x$$ and $$g(x) = x$$.
- Compute $$f(x) - g(x) = (2 - x) - x = 2 - 2x$$.
- For $$x > 1$$, $$2 - 2x < 0$$, so $$g(x) > f(x)$$.
- Area on $$[1,2]$$ is $$\int_1^2 (x - (2 - x)) \, dx = \int_1^2 (2x - 2) \, dx$$.
4. **Calculate integrals:**
- $$\int_0^1 (x - x^2) \, dx = \left[ \frac{x^2}{2} - \frac{x^3}{3} \right]_0^1 = \frac{1}{2} - \frac{1}{3} = \frac{1}{6}$$.
- $$\int_1^2 (2x - 2) \, dx = \left[ x^2 - 2x \right]_1^2 = (4 - 4) - (1 - 2) = 0 - (-1) = 1$$.
5. **Total area for Q9:** $$\frac{1}{6} + 1 = \frac{7}{6} \approx 1.1667$$.
6. **Problem Statement for Q10:** Use Python numerical integration to find the area between $$f(x) = x^3$$ and $$g(x) = x$$ over $$[0,1]$$.
7. **Mathematical Setup:** The area is $$\int_0^1 |x - x^3| \, dx$$.
8. **Since $$x \geq x^3$$ on $$[0,1]$$, area simplifies to $$\int_0^1 (x - x^3) \, dx$$.
9. **Analytical solution:** $$\int_0^1 (x - x^3) \, dx = \left[ \frac{x^2}{2} - \frac{x^4}{4} \right]_0^1 = \frac{1}{2} - \frac{1}{4} = \frac{1}{4} = 0.25$$.
10. **Python code provided uses scipy.integrate.quad to numerically compute this integral, confirming the analytical result.**
**Final answers:**
- Q9 area = $$\frac{7}{6}$$
- Q10 area (numerical) = approximately 0.25