import numpy as np
import matplotlib.pyplot as plt# Define the functions
def g(x):return np.sin(x)def f(u):return np.sqrt(1 - u**2)def f_composite_g(x):return np.abs(np.cos(x))# Create x values
x = np.linspace(-2*np.pi, 2*np.pi, 1000)# Create the plot
plt.figure(figsize=(12, 8))# Plot g(x) = sin(x)
plt.subplot(2, 2, 1)
plt.plot(x, g(x))
plt.title('g(x) = sin(x)')
plt.xlabel('x')
plt.ylabel('g(x)')
plt.grid(True)# Plot f(u) = sqrt(1 - u^2)
u = np.linspace(-1, 1, 1000)
plt.subplot(2, 2, 2)
plt.plot(u, f(u))
plt.title('f(u) = sqrt(1 - u^2)')
plt.xlabel('u')
plt.ylabel('f(u)')
plt.grid(True)# Plot (f ∘ g)(x) = |cos(x)|
plt.subplot(2, 2, (3, 4))
plt.plot(x, f_composite_g(x))
plt.title('(f ∘ g)(x) = |cos(x)|')
plt.xlabel('x')
plt.ylabel('(f ∘ g)(x)')
plt.grid(True)plt.tight_layout()
plt.show()