Task:
Using R, provide the solution for any exercise in either Chapter 4 or Chapter 7 of the calculus textbook. If you are unsure of your solution, post your concerns.

Book: APEX Calculus Version 4
Chapter 7 - Applications of Integration
Exercise 7.1- Page 360

19. The functions \(f(x) = cos(x)\) and \(g(x) = sin x\) intersect infinitely many times, forming an infinite number of repeated, enclosed regions. Find the areas of these regions.

Find the intervals

Set \(sin(x) = cos(x)\)
Divide both sides by \(cos(x)\)
\(\frac{sin(x)}{cos(x)} = \frac{cos(x)}{cos(x)}\)
\(\frac{sin(x)}{cos(x)} = 1\)
as \(\frac{sin(x)}{cos(x)} = tan(x)\),
\(tan(x) = 1\)
angles where \(tan(x) = 1\), which are \(π/4\) and \(5π/4\) will be the intervals.

x <- seq (0, 2*pi, 0.01)
equation_f <- function(x){cos(x)}
curve(equation_f, from=1, to=2*pi, n= 200, xlab="Y", ylab="X", col="blue",lwd=2, 
             main="Plot of  cos(x) and sin(x)")
equation_g <- function(x){sin(x)}
curve(equation_g, from=1, to=2*pi, add=TRUE, xlab="Y", ylab="X", col="blue",lwd=2, 
             main="Plot of  cos(x) and sin(x)")
polygon(c(x,rev(x)),c(equation_f(x),rev(equation_g(x))),col="skyblue")

Find the area bounded by the function \(f(x) = cos(x)\) and \(g(x) = sin(x)\) on the interval\([\frac{\pi}{4},\frac{5\pi}{4}]\)

\(\int_{\frac{\pi}{4}}^{\frac{5\pi}{4}}[sin(x)-cos(x)] dx\)
\(-cos(x) - sin(x) |_{\frac{\pi}{4}}^{\frac{5\pi}{4}}\) \((-cos(\frac{5\pi}{4})-sin(\frac{5\pi}{4})) - (-cos(\frac{\pi}{4})-sin(\frac{\pi}{4}))\)
\((\frac{\sqrt2}{2} - (-\frac{\sqrt2}{2})) - (\frac{\sqrt2}{2} - (\frac{\sqrt2}{2}))\)
\(\sqrt2 - (-\sqrt2)\)
Area = \(2\sqrt2\) sq units.