Step 1: Understanding the Concept:
The given equation is a first-order linear differential equation. We can simplify it by using a suitable substitution to reduce it to a separable form.
Step 2: Key Formula or Approach:
Rearrange the equation to group related terms.
If $\frac{dv}{dx} = f(x)v$, then the solution is $v = Ae^{\int f(x) dx}$.
Step 3: Detailed Explanation:
The given differential equation is:
\[ \frac{dy}{dx} = 2x(y + 2\sin x - 5) - 2\cos x \]
Rearranging the terms:
\[ \frac{dy}{dx} + 2\cos x = 2x(y + 2\sin x - 5) \]
Notice that $\frac{d}{dx}(y + 2\sin x - 5) = \frac{dy}{dx} + 2\cos x$.
Let $v = y + 2\sin x - 5$.
Substituting this into the equation, we get:
\[ \frac{dv}{dx} = 2xv \]
This is a separable differential equation:
\[ \frac{dv}{v} = 2x \, dx \]
Integrating both sides:
\[ \ln |v| = x^2 + C \]
\[ v = Ae^{x^2} \]
Substitute back for $v$:
\[ y + 2\sin x - 5 = Ae^{x^2} \]
Using the initial condition $y(0) = 7$:
\[ 7 + 2\sin(0) - 5 = Ae^0 \]
\[ 7 + 0 - 5 = A \cdot 1 \implies A = 2 \]
The general solution is:
\[ y + 2\sin x - 5 = 2e^{x^2} \]
To find $y(\pi)$, substitute $x = \pi$:
\[ y(\pi) + 2\sin(\pi) - 5 = 2e^{\pi^2} \]
\[ y(\pi) + 0 - 5 = 2e^{\pi^2} \]
\[ y(\pi) = 2e^{\pi^2} + 5 \]
Step 4: Final Answer:
The value of $y(\pi)$ is $2e^{\pi^2} + 5$.