Plotting two surfaces and visualizing their intersection

Trying to plot the following two functions to show points of intersection.

2 x + y - 1 == 0,
x - y + 2 == 0
ContourPlot[{2 x + y - 1 == 0, x - y + 2 == 0}, {x, -5, 5}, {y, -5, 5}]

The above shows the plots, but I find it difficult to see the point of intersection. I suspect that there is a better method than this.

Please suggest a good method to plot such equations.

• The intersection is the point where both lines meet. What difficulties do you have to see it? – Dr. belisarius May 1 '13 at 1:43
• True. I am unable to highlight the point and show its co-ordinates. I have looked at an approach in the following question. Is there a similar method that can be used here ? mathematica.stackexchange.com/questions/10472/…. – user7210 May 1 '13 at 1:53
• @user7210 are you looking for more than is in my answer? – Jonathan Shock May 3 '13 at 1:19

If you want to know the value of the points then you can use Solve. If you want to be able to see the intersection point highlighted then you can add a point at that value of x and y:

eqs = {2 x + y - 1 == 0, x - y + 2 == 0}
sol = {x, y} /. Solve[eqs, {x, y}]
Show[ListPlot[sol, PlotStyle -> PointSize -> 0.02],ContourPlot[Evaluate[eqs], {x, -5, 5}, {y, -5, 5}]]
ContourPlot[{2 x + y - 1 == 0, x - y + 2 == 0}, {x, -5, 5}, {y, -5,  5},
MeshFunctions -> {Function[{x, y}, 2 x + y - 1 - (x - y + 2)]},
MeshStyle -> Directive[PointSize[Large], Red], Mesh -> {{0}}] You could put these linear equations in matrix form:

i = LinearSolve[a = {{2, 1}, {1, -1}}, b = {1, -2}]
ContourPlot[Evaluate@Thread[a.{x, y} == b], {x, -3, 3}, {y, -3, 3},
Epilog -> {Red, PointSize[0.02], Point[i]},
PlotLegends -> "Expressions"] 