Solve a system of differential equations I want to know how solve the following system of differential equations.
$$\frac {dy}{dx} = z-x$$
$$\frac{dz}{dx}=y+x$$
Where $y(0)=1, z(0)=1$  
As I can understand I cannot represent this system as $x'=Ax$. What is the correct method to solve this system.
 A: For example, take the second equation and differentiate; so $$\frac{d^2 z}{dx^2}=\frac{dy}{dx}+1$$ Now replace $\frac{dy}{dx}$ as given by the first equation and so $$\frac{d^2 z}{dx^2}=z-x+1$$ which is of second order. Solve it for $z$ using the conditions and go back to $y$ later.
A: Five answers and no one is pointing out the reasoning for the most intuitive method. I'll add one.

Here's the classic way, with no matrices involved. We had:
$$\frac {dy}{dx} = z-x$$  
What's $y$?
$$y = \frac{dz}{dx} - x$$
Substitute it back into the first equation:
$$\frac {d}{dx} \left( \frac{dz}{dx} - x \right) = z-x$$  
$$\frac{d^2z}{dx^2} - z = 1-x$$  
Note that I didn't spontaneously say "differentiate the second equation" like in the first answer; I just substituted the value of $y$ into the first equation.  
Now you have to do is to solve this second-order ODE. But you can eyeball the solution!
If the right-hand side was zero then $$z(x) = c_1 e^x + c_2 e^{-x}$$ could be a solution, because the equation is saying that the second derivative must be equal to the original function. But since there's a non-homogeneity on the right, and since polynomials vanish with differentiation, you can set $$z(x) = c_1 e^x + c_2 e^{-x} + x - 1$$ which stays in the $z$ term but vanishes (i.e. becomes zero) in the $\frac{d^2z}{dx^2}$ term.  
Now use the initial conditions:


*

*If $z(0) = 1$ then $c_1 + c_2 = 2$.  

*If $y(0) = 1$ then $\frac{dz}{dx}(0) = 1 \implies c_1 - c_2 = 0$.


This implies $c_1 = 1$ and $c_2 = 1$.

Note that you can represent this system with $d\vec{x}/dx = A\vec{x}$; the trick is to let $\vec{x} = \begin{bmatrix} 1 & x & y & z \end{bmatrix}^\intercal$:
$$A = \begin{bmatrix} 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 1 \\ 0 & 1 & 1 & 0 \end{bmatrix}$$
But you don't have to. You can represent it as $d\vec{x}/dx = A\vec{x} + \vec{b}$ where $\vec{x} = \begin{bmatrix} x & y & z \end{bmatrix}^\intercal$ and
$$A = \begin{bmatrix} 0 & 0 & 0 \\ -1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}$$
$$\vec{b} = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}^\intercal$$
You can solve this system by solving the homogeneous $\vec{x}' = A\vec{x}$ (use matrix exponentials) and then adding the non-homogeneity $\vec{b}$, similarly to how we solve the scalar version.
A: suggested method: if you add the equations you find that $y+z$ is an exponential in $x$. i.e.
$$
\frac{d(y+z)}{dx}=y+z
$$
if you multiply the equations by $y$ and $z$ respectively and subtract, then with a little manipulation you can obtain $y^2-z^2$ as a related exponential.
$$
\frac{d(z^2-y^2)}{dx} = x(z-y)=(z^2-y^2)\frac{x}{z+y}
$$
dividing $z^2-y^2$ by $z+y$ you now obtain $z-y$ and so (with $z+y$) can solve for $y$ and $z$ and evaluate the parameters (integration constants) from the initial conditions.
$$
z^2-y^2= Be^{A\int xe^{-x}}
$$
A: There is an error with the Laplace Transform technique. Here is the right solution. 
Using the initial conditions and taking the Laplace Transform gives :
$$sY(s)-1=Z(s)-\frac{1}{s^2}$$ 
and
$$sZ(s)-1=Y(s)+\frac{1}{s^2}$$
Solving for $Y(s)$ and $Z(s)$, on obtain :
$$Y(s)=\frac{1}{(s-1)}-\frac{1}{(s+1)}-\frac{1}{s^2}+\frac{1}{s}$$
and
$$Z(s)=\frac{1}{(s-1)}+\frac{1}{(s+1)}+\frac{1}{s^2}-\frac{1}{s}$$
The final solutions are : 
$$y(x) = 2\sinh(x)-x+1$$
and
$$z(x) = 2\cosh(x)+x-1$$ Graphically we obtain :

Enjoy. 
A: An alternative method is using Laplace transforms for systems of differential equations. Here, 
\begin{align} 
\mathcal{L} \left\{\frac {dy}{dx} \right\} &= \mathcal{L}\{z-x\} \\  
\mathcal{L} \left\{\frac {dz}{dx} \right\} &= \mathcal{L}\{y+x\}
\end{align}
become
\begin{align} \require{cancel}
sY(s)-\cancelto{1}{y(0)} &= Z(s)-\frac 1{s^2} \tag{A} \\  
sZ(s)-\cancelto{1}{z(0)} &= Y(s)+ \frac 1{s^2} \tag{B}
\end{align}
A: Take the derivative of the first equation.  This yields $y''(x)=z'(x)-1$.  Plug this into the second equation.  This gives $y''(x)+1=y(x)+x$.  This is now a differential equation with linear coefficients.  Perhaps you can use the method of undetermined coefficients to solve it?
A: i think one way is to find a particular solution to get rid of the forcing. so look for a particular solution of the form $$y = Ax + B, z = Cx + D $$ where $A, B, C$ and $D$ are contents to be determined. substituting these in $$\frac{dy}{dx} = z- x, 
\frac{dz}{dx} = y + x $$ you find that $$y = 1 - x, z = x - 1$$ is a solution. the solution to the homogeneous problem is much easier $$\frac{dy}{dx} = z, 
\frac{dz}{dx} = y$$ is easier because you can eliminate, say $z$, and second order equation $$\frac{d^2y}{dx^2} = y $$ which has the solution $$y = A\cosh x + B \sinh x, z = A\sinh x + B \cosh x$$
finally, the general solution is $y = 1 - x + A\cosh x + B \sinh x, z = -1 + x + A\sinh x + B \cosh x$
we can now compute the constants $A, B$ by requiring $y = z = 1$ at $x = 0.$ that gives $A = 0, B = 2$
$$y = 1 - x +2\sinh x, z = -1+x+2\cosh x$$
