Tutorials › Calculus III › Sampling a Vector Field on a Grid

Vector Fields and Flow · Tutorial 710 of 999

Sampling a Vector Field on a Grid

Build a reliable table of vector values by selecting grid points, checking the domain, and evaluating each component in the correct coordinate order.

Beginner 8 min read

What You'll Learn

  • Choose a finite rectangular grid of points for sampling a vector field.
  • Check whether each selected point belongs to the field’s domain.
  • Evaluate vector components separately at each grid point.
  • Organize point coordinates and vector values in a clear table.
  • Distinguish a sampled table from a complete description of a vector field.
  • Check sample values by substituting coordinates back into the component formulas.

Why Sample a Vector Field?

A vector field assigns a vector to each point in its domain. Its formula may describe infinitely many point-vector assignments, which cannot all be written out in a finite table. Sampling chooses a manageable collection of points and records the vector assigned at each one.

This is useful when preparing values for a plot, comparing a formula with a diagram, or checking calculations at selected locations. A table does not replace the formula and does not describe what happens between its chosen points. It is a finite record of particular evaluations.

For a two-dimensional field, write the component functions as \(P\) and \(Q\), so that \(\mathbf{F}(x,y)=\langle P(x,y),Q(x,y)\rangle\). At a point \((a,b)\), the field value is \(\mathbf{F}(a,b)=\langle P(a,b),Q(a,b)\rangle\). The point gives the location; the ordered pair of components gives the vector assigned there.

Definition: A grid sample of a vector field is a finite list of points in the field’s domain, together with the vector value obtained by evaluating the field at each point. A sampling table records those points and values in an organized form.

Choosing Points for the Grid

A rectangular grid is often convenient. Choose a finite set of \(x\)-coordinates and a finite set of \(y\)-coordinates, then use their coordinate combinations as sample points. For example, choosing \(x\)-coordinates \(0,1,2\) and \(y\)-coordinates \(-1,1\) gives six points.

$$ (0,-1),\ (1,-1),\ (2,-1),\ (0,1),\ (1,1),\ (2,1). $$

The grid need not be square, equally spaced, or centered at the origin. The choices should suit the purpose of the table and remain within the field’s domain. If the formula is undefined at some points, those points cannot be included as ordinary samples. For a field whose domain excludes the origin, for instance, a grid may need to omit \((0,0)\).

It is helpful to decide on a consistent ordering for the rows, such as listing all chosen \(x\)-coordinates for one \(y\)-coordinate before moving to the next \(y\)-coordinate. The order is not mathematically essential, but it makes the table easier to read and helps prevent coordinate mix-ups.

Worked Example: Sampling a Field on a Rectangular Grid

Worked Example: Sampling a Field on a Rectangular Grid

Let \(\mathbf{F}(x,y)=\langle 2x-y,\ x+y\rangle\). Sample the field on the grid with \(x=0,1,2\) and \(y=-1,1\).

The component functions are \(P(x,y)=2x-y\) and \(Q(x,y)=x+y\). The field is defined at every point in this grid. Evaluate both components at each point:

  • At \((0,-1)\): \(P(0,-1)=2(0)-(-1)=1\), and \(Q(0,-1)=0+(-1)=-1\). Thus, \(\mathbf{F}(0,-1)=\langle 1,-1\rangle\).
  • At \((1,-1)\): \(P(1,-1)=2(1)-(-1)=3\), and \(Q(1,-1)=1+(-1)=0\). Thus, \(\mathbf{F}(1,-1)=\langle 3,0\rangle\).
  • At \((2,-1)\): \(P(2,-1)=2(2)-(-1)=5\), and \(Q(2,-1)=2+(-1)=1\). Thus, \(\mathbf{F}(2,-1)=\langle 5,1\rangle\).
  • At \((0,1)\): \(P(0,1)=2(0)-1=-1\), and \(Q(0,1)=0+1=1\). Thus, \(\mathbf{F}(0,1)=\langle -1,1\rangle\).
  • At \((1,1)\): \(P(1,1)=2(1)-1=1\), and \(Q(1,1)=1+1=2\). Thus, \(\mathbf{F}(1,1)=\langle 1,2\rangle\).
  • At \((2,1)\): \(P(2,1)=2(2)-1=3\), and \(Q(2,1)=2+1=3\). Thus, \(\mathbf{F}(2,1)=\langle 3,3\rangle\).

Here is the resulting table. The component columns show the two values separately; the final column collects them as a vector.

Point \((x,y)\)\(P(x,y)=2x-y\)\(Q(x,y)=x+y\)\(\mathbf{F}(x,y)\)
\((0,-1)\)\(1\)\(-1\)\(\langle 1,-1\rangle\)
\((1,-1)\)\(3\)\(0\)\(\langle 3,0\rangle\)
\((2,-1)\)\(5\)\(1\)\(\langle 5,1\rangle\)
\((0,1)\)\(-1\)\(1\)\(\langle -1,1\rangle\)
\((1,1)\)\(1\)\(2\)\(\langle 1,2\rangle\)
\((2,1)\)\(3\)\(3\)\(\langle 3,3\rangle\)

Check one row directly from the defining formula: at \((2,1)\), \(\mathbf{F}(2,1)=\langle 2(2)-1,\ 2+1\rangle=\langle 3,3\rangle\), matching the table. The table contains six samples, not a complete account of the field at every point.

What the Table Records

Each row of a sampling table connects two different pieces of information: a point where the field is evaluated and the vector value assigned at that point. The point is not itself the vector. For instance, in the preceding example the point \((2,-1)\) receives the vector \(\langle 5,1\rangle\), not the vector \(\langle 2,-1\rangle\).

For a field \(\mathbf{F}(x,y)=\langle P(x,y),Q(x,y)\rangle\), both component values must be evaluated using the same point. The first component is \(P(a,b)\); the second is \(Q(a,b)\). Keeping these in the stated order preserves the field’s definition.

The entries also provide the numerical information needed to place arrows when plotting is the goal. At a sample point \((a,b)\), the associated vector \(\langle u,v\rangle\) has horizontal component \(u\) and vertical component \(v\). As a coordinate check, if an arrow is drawn with its tail at \((a,b)\), its head is at \((a+u,b+v)\). This relationship explains why both the location and the vector components belong in a plotting table.

Takeaway: A sample row should identify the point, give the value of every component there, and combine those component values in the correct order to form the vector.

Worked Example: Respecting a Restricted Domain

Worked Example: Respecting a Restricted Domain

Consider \(\mathbf{G}(x,y)=\left\langle \frac{x}{x^2+y^2},\frac{y}{x^2+y^2}\right\rangle\). Sample it at \((1,0),(0,1),(-1,0),(0,-1),(1,1),(-1,1)\), and determine whether the origin can be included.

The common denominator \(x^2+y^2\) equals zero only when \(x=0\) and \(y=0\). Therefore the field is defined at all six requested points but not at the origin.

  • At \((1,0)\), the denominator is \(1^2+0^2=1\), so \(\mathbf{G}(1,0)=\langle 1/1,0/1\rangle=\langle 1,0\rangle\).
  • At \((0,1)\), the denominator is \(0^2+1^2=1\), so \(\mathbf{G}(0,1)=\langle 0/1,1/1\rangle=\langle 0,1\rangle\).
  • At \((-1,0)\), the denominator is \((-1)^2+0^2=1\), so \(\mathbf{G}(-1,0)=\langle -1/1,0/1\rangle=\langle -1,0\rangle\).
  • At \((0,-1)\), the denominator is \(0^2+(-1)^2=1\), so \(\mathbf{G}(0,-1)=\langle 0/1,-1/1\rangle=\langle 0,-1\rangle\).
  • At \((1,1)\), the denominator is \(1^2+1^2=2\), so \(\mathbf{G}(1,1)=\langle 1/2,1/2\rangle\).
  • At \((-1,1)\), the denominator is \((-1)^2+1^2=2\), so \(\mathbf{G}(-1,1)=\langle -1/2,1/2\rangle\).
Point \((x,y)\)Denominator \(x^2+y^2\)\(\mathbf{G}(x,y)\)Status
\((1,0)\)\(1\)\(\langle 1,0\rangle\)Defined
\((0,1)\)\(1\)\(\langle 0,1\rangle\)Defined
\((-1,0)\)\(1\)\(\langle -1,0\rangle\)Defined
\((0,-1)\)\(1\)\(\langle 0,-1\rangle\)Defined
\((1,1)\)\(2\)\(\langle 1/2,1/2\rangle\)Defined
\((-1,1)\)\(2\)\(\langle -1/2,1/2\rangle\)Defined
\((0,0)\)\(0\)Not definedExclude

For a direct check at \((-1,1)\), the component values are \(-1/[(-1)^2+1^2]=-1/2\) and \(1/[(-1)^2+1^2]=1/2\), as recorded. At \((0,0)\), each displayed component would require division by zero, so there is no vector value to put in an ordinary sample row.

Why Component-by-Component Evaluation Works

The rule for evaluating a vector field follows directly from what its component notation means. If \(\mathbf{F}(x,y)=\langle P(x,y),Q(x,y)\rangle\), then the field assigns to \((x,y)\) the ordered pair consisting of the values of \(P\) and \(Q\) at that same point. Substituting \((a,b)\) into the assignment therefore gives \(\langle P(a,b),Q(a,b)\rangle\).

$$ \mathbf{F}(x,y)=\langle P(x,y),Q(x,y)\rangle \quad\Longrightarrow\quad \mathbf{F}(a,b)=\langle P(a,b),Q(a,b)\rangle. $$

For plotting, a vector \(\langle u,v\rangle\) represents a displacement of \(u\) in the first coordinate and \(v\) in the second coordinate. Starting at \((a,b)\), the endpoint is \((a+u,b+v)\), since the first coordinate changes from \(a\) to \(a+u\) and the second from \(b\) to \(b+v\). Thus the table’s location and vector columns together carry exactly the information needed to place each sampled arrow. This does not imply that the finite table determines the field between sample points; it only explains how each recorded value corresponds to an arrow at its own location.

Worked Example: Evaluating Both Components at Every Point

Worked Example: Evaluating Both Components at Every Point

Let \(\mathbf{H}(x,y)=\langle y^2,\ x-y\rangle\). Sample it at the four points formed by \(x=-1,1\) and \(y=0,2\).

The field is defined everywhere because both components are polynomials. Evaluate in the component order \(y^2\), then \(x-y\):

  • At \((-1,0)\), \(y^2=0^2=0\) and \(x-y=-1-0=-1\), so \(\mathbf{H}(-1,0)=\langle 0,-1\rangle\).
  • At \((1,0)\), \(y^2=0^2=0\) and \(x-y=1-0=1\), so \(\mathbf{H}(1,0)=\langle 0,1\rangle\).
  • At \((-1,2)\), \(y^2=2^2=4\) and \(x-y=-1-2=-3\), so \(\mathbf{H}(-1,2)=\langle 4,-3\rangle\).
  • At \((1,2)\), \(y^2=2^2=4\) and \(x-y=1-2=-1\), so \(\mathbf{H}(1,2)=\langle 4,-1\rangle\).
Point \((x,y)\)First component \(y^2\)Second component \(x-y\)\(\mathbf{H}(x,y)\)
\((-1,0)\)\(0^2=0\)\(-1-0=-1\)\(\langle 0,-1\rangle\)
\((1,0)\)\(0^2=0\)\(1-0=1\)\(\langle 0,1\rangle\)
\((-1,2)\)\(2^2=4\)\(-1-2=-3\)\(\langle 4,-3\rangle\)
\((1,2)\)\(2^2=4\)\(1-2=-1\)\(\langle 4,-1\rangle\)

As a check, substituting \((1,2)\) into the original field gives \(\mathbf{H}(1,2)=\langle 2^2,1-2\rangle=\langle 4,-1\rangle\). Both components match the table. Notice that the first component depends only on \(y\), while the second depends on both coordinates; this does not change the requirement to evaluate each component at the selected point.

A Common Coordinate-Order Mistake

A frequent error is to reverse the coordinates during substitution, or to use the first coordinate in place of the second. Consider \(\mathbf{F}(x,y)=\langle 2x-y,\ x+y\rangle\) at \((1,2)\). A mistaken calculation might use \(x=2\) and \(y=1\), producing \(\langle 2(2)-1,\ 2+1\rangle=\langle 3,3\rangle\). That is the value at \((2,1)\), not at \((1,2)\).

The correction is to keep the coordinate order fixed: at \((1,2)\), \(x=1\) and \(y=2\). Therefore \(2x-y=2(1)-2=0\), and \(x+y=1+2=3\), so \(\mathbf{F}(1,2)=\langle 0,3\rangle\). Substitution back into the component formulas confirms both entries.

Practical check: Write the point as \((x,y)=(a,b)\) before evaluating. Then use \(a\) everywhere the formula contains \(x\), and \(b\) everywhere it contains \(y\). Preserve the order of the component functions when forming the vector.

From a Formula to a Plotting Table

A reliable sampling process keeps the domain check, substitutions, and table construction distinct. This makes errors easier to find before the values are used in a plot.

1
Choose the points.
Select a finite set of grid coordinates suited to the desired coverage. Form the point pairs using one consistent order.
2
Check the domain.
Confirm that the field is defined at every point you plan to sample. Mark excluded points rather than assigning them invented values.
3
Evaluate each component.
Substitute the same point into every component formula, showing enough arithmetic to verify the result.
4
Record the ordered vector.
Place the component values in the same order as in the field definition, and check selected rows against the original formula.

For a field with more than two components, the same principle applies: use each selected point and evaluate every component there. A table remains a finite sample, however many components the vectors have. More sample points can give more information for a plot, but no finite grid by itself supplies values at every point in a continuous region.

Sampling matters because it creates a bridge between an algebraic formula and a visual representation. Careful tables make the locations explicit, preserve the component order, and make domain restrictions visible. They also provide a straightforward way to catch arithmetic mistakes before interpreting a diagram.

Check Your Understanding

Use the component formulas and domain information carefully when answering these questions.

  1. For \(\mathbf{F}(x,y)=\langle x+y,\ 2x-y\rangle\), what vector is assigned to \((1,-2)\)?
  2. If a field is undefined at the origin, what should a sampling table do when a proposed grid includes \((0,0)\)?
  3. For a vector value \(\langle 3,-2\rangle\) at the point \((1,4)\), what are the coordinates of the arrow’s head if its tail is at that point?
  4. Why does a table of finitely many samples not give the field’s value at every point in a region?
  5. What coordinate substitution error produces the value at \((b,a)\) when the intended sample point is \((a,b)\)?