1. **State the problem:** Solve the first-order linear differential equation $$\frac{dy}{dx} + \frac{y}{x} = \sin x, \quad x > 0.$$ Find the general solution for $y$ in terms of $x$. Then, given the initial condition $y\left(\frac{\pi}{4}\right) = \frac{1}{\sqrt{2}}$, find $y(\pi)$.
2. **Identify the integrating factor:** The equation is linear of the form $$\frac{dy}{dx} + P(x)y = Q(x)$$ with $$P(x) = \frac{1}{x}, \quad Q(x) = \sin x.$$ The integrating factor (IF) is $$\mu(x) = e^{\int P(x) dx} = e^{\int \frac{1}{x} dx} = e^{\ln x} = x.$$
3. **Multiply the entire differential equation by the integrating factor:**
$$x \frac{dy}{dx} + y = x \sin x.$$ This can be rewritten as
$$\frac{d}{dx}(xy) = x \sin x.$$
4. **Integrate both sides with respect to $x$:**
$$xy = \int x \sin x \, dx + C,$$
where $C$ is the constant of integration.
5. **Compute the integral $\int x \sin x \, dx$ using integration by parts:**
Let $$u = x \Rightarrow du = dx,$$
$$dv = \sin x \, dx \Rightarrow v = -\cos x.$$
Then,
$$\int x \sin x \, dx = -x \cos x + \int \cos x \, dx = -x \cos x + \sin x + C'.$$
6. **Substitute back:**
$$xy = -x \cos x + \sin x + C,$$
so
$$y = \frac{-x \cos x + \sin x + C}{x} = -\cos x + \frac{\sin x}{x} + \frac{C}{x}.$$
This is the general solution.
7. **Apply the initial condition $y\left(\frac{\pi}{4}\right) = \frac{1}{\sqrt{2}}$ to find $C$:**
$$\frac{1}{\sqrt{2}} = -\cos \frac{\pi}{4} + \frac{\sin \frac{\pi}{4}}{\frac{\pi}{4}} + \frac{C}{\frac{\pi}{4}}.$$
Calculate values:
$$\cos \frac{\pi}{4} = \frac{\sqrt{2}}{2}, \quad \sin \frac{\pi}{4} = \frac{\sqrt{2}}{2}.$$
So,
$$\frac{1}{\sqrt{2}} = -\frac{\sqrt{2}}{2} + \frac{\frac{\sqrt{2}}{2}}{\frac{\pi}{4}} + \frac{4C}{\pi}.$$
Simplify the fraction:
$$\frac{\frac{\sqrt{2}}{2}}{\frac{\pi}{4}} = \frac{\sqrt{2}}{2} \times \frac{4}{\pi} = \frac{2\sqrt{2}}{\pi}.$$
Rewrite the equation:
$$\frac{1}{\sqrt{2}} = -\frac{\sqrt{2}}{2} + \frac{2\sqrt{2}}{\pi} + \frac{4C}{\pi}.$$
Add $\frac{\sqrt{2}}{2}$ to both sides:
$$\frac{1}{\sqrt{2}} + \frac{\sqrt{2}}{2} = \frac{2\sqrt{2}}{\pi} + \frac{4C}{\pi}.$$
Note that $\frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{2}$, so left side is
$$\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2} = \sqrt{2}.$$
Multiply both sides by $\pi$:
$$\pi \sqrt{2} = 2\sqrt{2} + 4C.$$
Subtract $2\sqrt{2}$:
$$\pi \sqrt{2} - 2\sqrt{2} = 4C.$$
Factor $\sqrt{2}$:
$$\sqrt{2}(\pi - 2) = 4C,$$
so
$$C = \frac{\sqrt{2}(\pi - 2)}{4}.$$
8. **Find $y(\pi)$:**
$$y(\pi) = -\cos \pi + \frac{\sin \pi}{\pi} + \frac{C}{\pi} = -(-1) + 0 + \frac{\sqrt{2}(\pi - 2)}{4 \pi} = 1 + \frac{\sqrt{2}(\pi - 2)}{4 \pi}.$$
**Final answers:**
- General solution:
$$y = -\cos x + \frac{\sin x}{x} + \frac{C}{x}.$$
- Particular solution constant:
$$C = \frac{\sqrt{2}(\pi - 2)}{4}.$$
- Value at $x=\pi$:
$$y(\pi) = 1 + \frac{\sqrt{2}(\pi - 2)}{4 \pi}.$$
Linear Differential D03479
Step-by-step solutions with LaTeX - clean, fast, and student-friendly.