Two Dimensional

A line in 2 dimensional space can be parametrized using
p1+(p2-p1)t,
where p1 and p2 are two points and t is the parameter. This is also written as
x(t)=x1+(x2-x1)t
y(t)=y1+(y2-y1)t
where xi and yi are the coordinates of point pi.

In[40]:=

  ?ParametricPlot

  ParametricPlot[{fx, fy}, {t, tmin, tmax}] produces a
parametric plot with x and y coordinates fx and fy
generated as a function of t. ParametricPlot[{{fx, fy},
{gx, gy}, ...}, {t, tmin, tmax}] plots several
parametric curves.

Plot the line through the points p1={1,4} and p2={2,-5}.

In[41]:=

  p1=ParametricPlot[{1+t,4-9t},{t,-2,2}];

To verify that this indeed does go through the points, graph the points and combine the plots. Notice that I named the plots!

In[42]:=

  p2=ListPlot[{{1,4},{2,-5}}, PlotStyle->{PointSize[.03]}];

In[43]:=

  Show[p1,p2];

Let's use the other parametrization.

In[44]:=

  f[t_]:={1,4}+({2,-5}-{1,4})t

In[45]:=

  f[t]

Out[45]=

  {1 + t, 4 - 9 t}

In[46]:=

  ParametricPlot[f[t],{t,-2,2}];

A line can also be generated if you know a point and a vector that is orthogonal (perpendicular) to the line. The equation is
(p-p0).n=0
where p is the arbitrary point, p0 is the known point, and n is the normal vector.

The ContourPlot function is good for plotting implictly defined functions. This example plots xy=1. Note the function you plot is xy, the 1 is given in the Countours->{ } option.

In[47]:=

  ?ContourPlot

  ContourPlot[f, {x, xmin, xmax}, {y, ymin, ymax}] generates
a contour plot of f as a function of x and y.

In[48]:=

  ContourPlot[x y,{x,-2,2},{y,-2,2},Contours->{1},
  ContourShading->False];

Here is a plot of the line through the point (1,2) with normal vector (-1,1).

In[49]:=

  p3=ContourPlot[({x,y}-{1,2}).{-1,1},{x,-2,2},{y,-2,2},
  Contours->{0},ContourShading->False];

You can see the point (1,2) is on the graph. Is the line orthogonal to (-1,1)? Let's see.

In[50]:=

  p4=vectorPlot[{{0,0}},{{-1,1}}];
  Show[p3,p4];

Up to Lines and Planes