Step 1: Definition of composition of functions.
The composition of two functions \(f\) and \(g\) is defined as:
\[ (g \circ f)(x) = g(f(x)) \] \[ (f \circ g)(x) = f(g(x)) \] Step 2: Find the expressions for \(g \circ f\) and \(f \circ g\).
(i) For \(g \circ f\):
\[ (g \circ f)(x) = g(f(x)) = g(\cos x) = 3(\cos x)^2 \] Thus, \( (g \circ f)(x) = 3 \cos^2 x \).
(ii) For \(f \circ g\):
\[ (f \circ g)(x) = f(g(x)) = f(3x^2) = \cos(3x^2) \] Thus, \( (f \circ g)(x) = \cos(3x^2) \).
Step 3: Compare \(g \circ f\) and \(f \circ g\).
We have the following two expressions:
\[ (g \circ f)(x) = 3 \cos^2 x \] and \[ (f \circ g)(x) = \cos(3x^2) \] Clearly, these two expressions are not equal for all \(x \in \mathbb{R}\), as \(3 \cos^2 x\) and \(\cos(3x^2)\) represent different functions.
Step 4: Conclusion.
Since \( (g \circ f)(x) \neq (f \circ g)(x) \) for all values of \(x\), we have shown that \( g \circ f \neq f \circ g \).
Final Answer: \( g \circ f \neq f \circ g \).