To solve the integral \( \int x^2 e^{3x} \, dx \) and find \( f(x) \) in the equation \( \int x^2 e^{3x} \, dx = \frac{e^{3x}}{27} f(x) + C \), we can use integration by parts.
### Step-by-Step Solution:
1. **Identify Functions for Integration by Parts**:
Let:
- \( u = x^2 \) (which we will differentiate)
- \( dv = e^{3x} \, dx \) (which we will integrate)
2. **Differentiate and Integrate**:
- Differentiate \( u \):
\[
du = 2x \, dx
\]
- Integrate \( dv \):
\[
v = \int e^{3x} \, dx = \frac{e^{3x}}{3}
\]
3. **Apply Integration by Parts Formula**:
The integration by parts formula is:
\[
\int u \, dv = uv - \int v \, du
\]
Substituting our values:
\[
\int x^2 e^{3x} \, dx = x^2 \cdot \frac{e^{3x}}{3} - \int \frac{e^{3x}}{3} \cdot 2x \, dx
\]
This simplifies to:
\[
= \frac{x^2 e^{3x}}{3} - \frac{2}{3} \int x e^{3x} \, dx
\]
4. **Integrate \( \int x e^{3x} \, dx \) Again by Parts**:
For \( \int x e^{3x} \, dx \), let:
- \( u = x \)
- \( dv = e^{3x} \, dx \)
Then:
- \( du = dx \)
- \( v = \frac{e^{3x}}{3} \)
Applying integration by parts again:
\[
\int x e^{3x} \, dx = x \cdot \frac{e^{3x}}{3} - \int \frac{e^{3x}}{3} \, dx
\]
This simplifies to:
\[
= \frac{x e^{3x}}{3} - \frac{1}{9} e^{3x}
\]
5. **Substituting Back**:
Now substitute back into the equation:
\[
\int x^2 e^{3x} \, dx = \frac{x^2 e^{3x}}{3} - \frac{2}{3} \left( \frac{x e^{3x}}{3} - \frac{1}{9} e^{3x} \right)
\]
Simplifying this:
\[
= \frac{x^2 e^{3x}}{3} - \frac{2x e^{3x}}{9} + \frac{2 e^{3x}}{27}
\]
6. **Combine Terms**:
To combine terms, factor out \( e^{3x} \):
\[
= e^{3x} \left( \frac{x^2}{3} - \frac{2x}{9} + \frac{2}{27} \right)
\]
Finding a common denominator (27):
\[
= e^{3x} \left( \frac{9x^2 - 6x + 2}{27} \right)
\]
7. **Final Form**:
Thus, we have:
\[
\int x^2 e^{3x} \, dx = \frac{e^{3x}}{27} (9x^2 - 6x + 2) + C
\]
8. **Identify \( f(x) \)**:
From the equation \( \int x^2 e^{3x} \, dx = \frac{e^{3x}}{27} f(x) + C \), we can see that:
\[
f(x) = 9x^2 - 6x + 2
\]
### Final Answer:
\[
f(x) = 9x^2 - 6x + 2
\]