# VectorPlot for Phase Plane for 2x2 Matrix

Can anyone help me with my VectorPlot of a phase plane? I've been able to set up a few VectorPlots for different differential equation systems, but this one I have trouble with. It has only one real eigenvalue with only one linearly independent eigenvector. I am able to generate just a phase plane but I can't seem to be able to graph solution curves within inside of it. I'm not sure what I'm doing wrong. I've used these same code for plotting other systems and it worked fine. Any help is much appreciated.

It's for a matrix:

A = {{7, 1}, {-4, 3}};
ev = Eigenvectors[A]

{{-1, 2}, {0, 0}}

λ = Eigenvalues[A]

{5, 5}

B = A - λ[]*IdentityMatrix

{{2, 1}, {-4, -2}}

u = LinearSolve[B, ev[]]

{-(1/2), 0}


The command IdentityMatrix[n] produces the n x n identity matrix, 2x2 in this case. We are assuming there is only one eigenvalue λ in this case. LinearSolve will solve the system B u = v for u. If there are parameters in the solution, you can select them arbitrarily to find a suitable u.

Clear [k1, k2];
Y = k1*E^(λ[] t) {-1, 2} + k2*(E^(λ[] t))[t {-1, 2}, {-1/2, 0}]

{-E^(5 t) k1 + k2 (E^(5 t))[{-t, 2 t}, {-(1/2), 0}],
2 E^(5 t) k1 + k2 (E^(5 t))[{-t, 2 t}, {-(1/2), 0}]}


And this is what should graph it along with some solution curves:

dir =
VectorPlot[{7 x + y, -4 x + 3 y}, {x, -2, 2}, {y, -2, 2},
VectorPoints -> 25, Axes -> True, Frame -> False,
VectorStyle -> {Black, Arrowheads[0.015]},
VectorScale -> {.015, 1, None}, PlotRange -> {{-2, 2}, {-2, 2}},
AxesOrigin -> {0, 0}, AxesLabel -> {"t", "y(t)"}];

soln1 = Flatten[Solve[(Y /. t -> 0) == {-1, 2}, {k1, k2}]];
g1 =
ParametricPlot[Y /. soln1, {t, -2, 2},
PlotStyle -> {Thickness[0.006], Red}];

soln2 = Flatten[Solve[(Y /. t -> 0) == {1, -2}, {k1, k2}]];
g2 =
ParametricPlot[Y /. soln2, {t, -2, 2},
PlotStyle -> {Thickness[0.006], Green}];

soln3 = Flatten[Solve[(Y /. t -> 0) == {1, 1}, {k1, k2}]];
g3 =
ParametricPlot[Y /. soln3, {t, -2, 2},
PlotStyle -> {Thickness[0.006], Magenta}];

soln4 = Flatten[Solve[(Y /. t -> 0) == {-1, 0}, {k1, k2}]];
g4 =
ParametricPlot[Y /. soln4, {t, -2, 2},
PlotStyle -> {Thickness[0.006], Blue}];

Show[dir, g1, g2, g3, g4, PlotRange -> {{-2, 2}, {-2, 2}}]


The phase plane I get, but I can't seem to be able to show different solution curves. They are not showing up properly ### Update

Never mind, I figured it out. The code that generates general equation should have "+" instead of ",":

Y = k1*E^(λ[] t) {-1, 2} + k2*(E^(λ[] t))[t {-1, 2}, {-1/2, 0}]


Needs to be:

Y = k1*E^(λ[] t) {-1, 2} + k2*(E^(λ[] t))[t {-1, 2} + {-1/2, 0}]


The expected result • There's a syntax error in your corrected expression for Y: the final matched pair of square brackets should be round parentheses. (Square brackets are never used in Mathematica as grouping punctuation, but only to enclose arguments. – murray Dec 7 '17 at 16:03