To solve the differential equation dy/dx = x + y, we can use the method of integrating factors or recognize it as a first-order linear ordinary differential equation.
Step 1: Rearranging the Equation
First, we can rewrite the equation in standard form:
dy/dx - y = x
Step 2: Finding the Integrating Factor
The integrating factor, μ(x), is calculated as follows:
μ(x) = e^∫(-1)dx = e^(-x)
Step 3: Multiplying by the Integrating Factor
Now, multiply the entire equation by the integrating factor:
e^(-x) * dy/dx - e^(-x) * y = e^(-x) * x
Step 4: Simplifying the Left Side
The left side can be expressed as the derivative of a product:
d/dx(e^(-x) * y) = e^(-x) * x
Step 5: Integrating Both Sides
Next, integrate both sides:
∫d(e^(-x) * y) = ∫e^(-x) * x dx
Using Integration by Parts
For the right side, we can use integration by parts:
- Let u = x and dv = e^(-x)dx.
- Then, du = dx and v = -e^(-x).
Applying integration by parts gives:
-xe^(-x) - ∫-e^(-x)dx = -xe^(-x) + e^(-x) + C
Step 6: Putting It All Together
Now, we have:
e^(-x) * y = -xe^(-x) + e^(-x) + C
Multiplying through by e^(x) to solve for y:
y = -x + 1 + Ce^(x)
Final Solution
The general solution to the differential equation is:
y = -x + 1 + Ce^(x), where C is a constant determined by initial conditions if provided.