# Solving a simple system of ODE's

DSolveValue[{x'[t] == 2 x[t] + E^t y[t] - E^t,
y'[t] == 4 E^-t x[t] + y[t]}, {x[t], y[t]}, t]


The solution should be sums of exponentials (for both x(t) and y(t)).

• Please post your code as text, not pictures. – MarcoB Aug 21 '17 at 3:08
• There are certain limitations to using DSolve, not every differential equation gets solved analytically using it. There are 2 things which you can do 1. Take a variable transformation such tat the equations can be written in a simpler form 2. If you have some initial conditions for the problem, try solving it numerically. – Bruce Lee Aug 21 '17 at 6:20

As proposed by @ Bruce Lee you may try the following. Let us represent x(t)=u(t)*v(t) and y(t)=g(t)*w(t) and substitute them into the equations:

eq1A=x'[t] == 2 x[t] + E^t y[t] - E^t /. x :> (u[#]*v[#] &) /.
y :> (g[#]*w[#] &)
eq2A=y'[t] == 4 E^-t x[t] + y[t] /. x :> (u[#]*v[#] &) /.
y :> (g[#]*w[#] &)

(*  v[t] Derivative[u][t] + u[t] Derivative[v][t] == -E^t +
2 u[t] v[t] + E^t g[t] w[t]
w[t] Derivative[g][t] + g[t] Derivative[w][t] ==
4 E^-t u[t] v[t] + g[t] w[t]    *)


Let us now choose v(t) and w(t) such that the terms 2 u[t] v[t] in the first equation and g[t] w[t]in the second one vanish:

DSolve[ Derivative[v][t] == 2 v[t], v[t], t][[1, 1]] /. C -> 1
DSolve[ Derivative[w][t] == w[t], w[t], t][[1, 1]] /. C -> 1

(*  v[t] -> E^(2 t)
w[t] -> E^t       *)


and substitute this into the equations obtained during the previous step:

eq1B = Map[Divide[#, E^t] &,
w[t] Derivative[g][t] + g[t] Derivative[w][t] ==
4 E^-t u[t] v[t] + g[t] w[t] /. w :> (E^# &) /.
v -> (E^(2 #) &) // Simplify]
eq2B = Map[Divide[#, E^t] &,
v[t] Derivative[u][t] + u[t] Derivative[v][t] == -E^t +
2 u[t] v[t] + E^t g[t] w[t] /. w :> (E^# &) /.
v -> (E^(2 #) &) // Simplify]

(*  4 u[t] == Derivative[g][t]
E^t g[t] == 1 + E^t Derivative[u][t]   *)


Note that I in addition cancelled the common term Exp[t]. Now one can calculate the derivative of the equation 1B and substitute it into 2B:

eq1C = Solve[Map[D[#, t] &, eq1B], u'[t]][[1, 1]]

(*  Derivative[u][t] -> (g^\[Prime]\[Prime])[t]/4  *)
(*  Derivative[u][t] -> (g^\[Prime]\[Prime])[t]/4  *)


Let us now substitute the result into eq2B:

 eq2C = eq2B /. eq1C

(*  E^t g[t] == 1 + 1/4 E^t (g^\[Prime]\[Prime])[t]  *)


The latter equation can be solved using DSolve :

DSolve[eq2C, g[t], t]

(*   {{g[t] -> (4 E^-t)/3 + E^(2 t) C + E^(-2 t) C}}   *)


Now one can go back and find the initial variables x and y. This is, however, already trivial.

Have fun!

The solution can be obtained without difficulty by observing that the substitution x[t] -> z[t] E^t immediately eliminates all exponentials from the two ODEs.

Unevaluated[{D[x[t], t] == 2 x[t] + E^t y[t] - E^t,
D[y[t], t] == 4 E^-t x[t] + y[t]}] /. x[t] -> z[t] E^t;


whereupon DSolve returns

Flatten@DSolve[%, {z[t], y[t]}, t] // Simplify

(* {y[t] -> 1/6 (8 + 3 E^-t (C - 2 C) + 3 E^(3 t) (C + 2 C)),
z[t] -> 1/12 E^-t (-4 E^t - 3 C + 6 C + 3 E^(4 t) (C + 2 C))} *)