dy/dx=x+y, y(0)=1

How do I solve for y(x)?

I know the answer is y(x)=2e^x-x-1, but I forgot how to do these kinds of problems again.

This is and ordinary differential equation with exact roots.

What I suggest to review these is to go to Barnes Noble, or any good bookstore, and purchase Schaum's Outline Series, Differential Equations, an excellent book and buy. Take a look.
There is an abridged version online
http://www.ebookmall.com/ebook/133885-ebook.htm
But, I would be wary of abridging a condensed study guide.

Good luck.

This is a first order linear differential equation and can be solved by the "integrating factor" method.

See http://www.sosmath.com/diffeq/first/lineareq/lineareq.html

To solve the differential equation dy/dx = x+y with the initial condition y(0) = 1, you can use the method of integrating factors. Follow these steps:

Step 1: Rewrite the equation in the standard form, which separates the variables x and y:
dy/dx - y = x

Step 2: Identify the integrating factor (IF). In this case, it is e^(∫(-1)dx), which simplifies to e^(-x).

Step 3: Multiply both sides of the equation by the integrating factor:
e^(-x) * (dy/dx - y) = x * e^(-x)

Step 4: Simplify the left side using the product rule of differentiation:
(e^(-x) * dy/dx) - (e^(-x) * y) = x * e^(-x)

Step 5: Rewrite the equation by recognizing that (e^(-x) * dy/dx) is the derivative of (e^(-x) * y) with respect to x:
d/dx(e^(-x) * y) = x * e^(-x)

Step 6: Integrate both sides of the equation with respect to x:
∫d/dx(e^(-x) * y) dx = ∫x * e^(-x) dx

Step 7: Evaluate the integrals:
e^(-x) * y = (-x - 1) * e^(-x) - e^(-x) + C

Step 8: Solve for y by dividing both sides by e^(-x):
y = (-x - 1) - 1 + Ce^x, where C is the constant of integration.

Step 9: Apply the initial condition y(0) = 1 to find the value of C:
1 = (-0 - 1) - 1 + Ce^0
1 = -2 + C
C = 3

Therefore, the particular solution to the given differential equation is:
y(x) = 2e^x - x - 1

To solve this differential equation, we can use the method of exact differential equations. Let's break down the steps:

Step 1: Rewrite the differential equation in the form of dy/dx = M(x,y) + N(x,y) * y'.

Given dy/dx = x + y, we can rewrite it as:
dy/dx - y = x

Here, M(x,y) = -y and N(x,y) = 1.

Step 2: Check for exactness.

To check if the equation is exact, we need to ensure that (∂M/∂y) = (∂N/∂x).

So, (∂M/∂y) = -1 and (∂N/∂x) = 0.

Since (∂M/∂y) is not equal to (∂N/∂x), the equation is not exact in its current form.

Step 3: Find an integrating factor.

To make the equation exact, we find an integrating factor, μ(x), such that μ(x) * M(x,y) + μ(x) * N(x,y) * y' = 0 becomes exact.

An integrating factor, μ(x), can be found using the formula:
μ(x) = e^∫(∂N/∂x - ∂M/∂y) dx

In this case, (∂N/∂x - ∂M/∂y) = 0 - (-1) = 1.

So, μ(x) = e^∫1 dx = e^x.

Step 4: Multiply the entire equation by the integrating factor.

Multiply the given equation dy/dx - y = x by the integrating factor e^x:
e^x * (dy/dx - y) = e^x * x

This simplifies to:
e^x * dy/dx - e^x * y = x * e^x

Step 5: Rewrite the left side of the equation.

Using the product rule for differentiation, the left side of the equation can be rewritten as:
d/dx (e^x * y) = x * e^x

Step 6: Integrate both sides of the equation.

Integrating both sides of the equation gives:
e^x * y = ∫x * e^x dx

Integrating x * e^x with respect to x gives:
e^x * y = e^x * (x - 1) + C

Step 7: Solve for y(x).

Divide both sides of the equation by e^x to isolate y(x):
y = x - 1 + C * e^(-x)

Now, we need to use the initial condition y(0) = 1 to find the value of C.

Substituting x = 0 and y = 1 into the equation, we get:
1 = 0 - 1 + C * e^0

Simplifying, we find:
1 = -1 + C
C = 2

Thus, the solution to the differential equation dy/dx = x + y with the initial condition y(0) = 1 is:
y(x) = x - 1 + 2 * e^(-x)

Note: The solution you mentioned, y(x) = 2e^x - x - 1, may have been obtained by rearranging the terms. Both forms are equivalent.