The given differential equation is $\frac{dy}{dx} + P(x)y = Q(x)$. The integrating factor (IF) for this equation is $e^{\int P(x) \, dx}$. Multiply both sides of the equation by the integrating factor:
\[
\begin{align}
e^{\int P(x) \, dx} \frac{dy}{dx} + e^{\int P(x) \, dx} P(x)y = e^{\int P(x) \, dx} Q(x)
\]
The problem states that the left-hand side takes the form $\frac{d}{dx} (y f(x))$. Let’s compute the left-hand side:
\[
e^{\int P(x) \, dx} \frac{dy}{dx} + e^{\int P(x) \, dx} P(x)y
\]
Notice that this resembles the product rule for differentiation. The product rule states that $\frac{d}{dx} (u v) = u \frac{dv}{dx} + v \frac{du}{dx}$. Let’s identify $u$ and $v$ such that the left-hand side matches this form:
- Let $v = y$ and $u = e^{\int P(x) \, dx}$.
- Then, $\frac{du}{dx} = e^{\int P(x) \, dx} P(x)$ (since the derivative of $\int P(x) \, dx$ with respect to $x$ is $P(x)$).
Applying the product rule:
\[
\begin{align}
\frac{d}{dx} (y e^{\int P(x) \, dx}) = e^{\int P(x) \, dx} \frac{dy}{dx} + y e^{\int P(x) \, dx} P(x)
\]
This matches the left-hand side exactly:
\[
\begin{align}
e^{\int P(x) \, dx} \frac{dy}{dx} + e^{\int P(x) \, dx} P(x)y = \frac{d}{dx} (y e^{\int P(x) \, dx})
\]
Thus, the left-hand side is $\frac{d}{dx} (y f(x))$, where $f(x) = e^{\int P(x) \, dx}$. Comparing with the options, this corresponds to option (3).
Thus, the correct answer is (3).