BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Graphs, networks and incidence matrices

Real matrices come from applications and have structure. A graph with n nodes and m edges, each edge given a direction, has an m × n incidence matrix A: row k has −1 at the node edge k leaves and +1 at the node it enters. For Strang's graph with 4 nodes and 5 edges, Ax lists the potential differences across the edges, so Ax = 0 exactly when all potentials are equal: N(A) is the line through (1, 1, 1, 1), potentials are fixed only up to a constant (grounding a node removes it), and the rank is n − 1 = 3. Rows of A around a loop are dependent. Currents y on the edges satisfy Kirchhoff's current law Aᵀy = 0, a balance at each node; its solutions are currents around loops, and N(Aᵀ) has dimension m − r = 2, with one basis vector for each independent loop. The pivot rows of A (here edges 1, 2 and 4) form a tree, a graph with no loops. The count dim N(Aᵀ) = m − (n − 1) gives Euler's formula: nodes − edges + loops = 1. With Ohm's law y = Ce and current sources f, the three steps e = Ax, y = Ce, Aᵀy = f combine into AᵀCAx = f, the basic equation of applied mathematics in equilibrium; AᵀA is always symmetric.

You need this first

Full reading path (15 pages)
  1. Vectors (8.01)
  2. Vectors and the dot product (18.02)
  3. Determinants and the cross product (18.02)
  4. Planes through three points, and matrices (18.02)
  5. Equations of planes and square systems (18.02)
  6. The geometry of linear equations (18.06)
  7. Elimination with matrices (18.06)
  8. Matrix multiplication and inverse matrices (18.06)
  9. Factorization into A = LU (18.06)
  10. Transposes, permutations and vector spaces (18.06)
  11. Column space and nullspace (18.06)
  12. Solving Ax = 0: pivot variables and special solutions (18.06)
  13. Solving Ax = b: the complete solution (18.06)
  14. Independence, basis and dimension (18.06)
  15. The four fundamental subspaces (18.06)
On this page · 7 sections
  1. The incidence matrix
  2. The nullspace: potentials
  3. The left nullspace: Kirchhoff's current law
  4. The row space and trees
  5. Euler's formula
  6. The basic equation of applied mathematics
  7. Summary

Strang confesses that the matrices in his examples are invented on the spot, while real linear algebra uses matrices that come from somewhere and have structure; chemists, for instance, row reduce matrices that describe reactions (transcript, p. 1). This lecture takes the most important model in applied mathematics, whose discrete version is a graph (p. 2). It continues the four fundamental subspaces.

The incidence matrix#

A graph has nodes and edges (transcript, p. 2). Strang's graph has n=4n = 4 nodes and m=5m = 5 edges, each given a direction by an arrow, chosen arbitrarily, to say which way a current counts as positive (pp. 2–3). The words will be those of an electrical network (potentials, currents), but the same model fits water or oil networks and structures such as bridges and domes (p. 3).

The incidence matrix has a row for each edge and a column for each node: −1-1 where the edge leaves, +1+1 where it arrives (pp. 3–5). With edge 1 from node 1 to 2, edge 2 from 2 to 3, edge 3 from 1 to 3, edge 4 from 1 to 4 and edge 5 from 3 to 4 (pp. 4–5):

The incidence matrix
A=(−11000−110−1010−100100−11)A = \begin{pmatrix} -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ -1 & 0 & 1 & 0 \\ -1 & 0 & 0 & 1 \\ 0 & 0 & -1 & 1 \end{pmatrix}
In words

capital A equals minus 1 1 0 0; 0 minus 1 1 0; minus 1 0 1 0; minus 1 0 0 1; 0 0 minus 1 1

Edges 1, 2 and 3 form a loop, and their rows are dependent: row 1 plus row 2 gives row 3 (p. 5). Loops will correspond to dependent rows. A large graph gives a large but sparse matrix: each row has exactly two nonzeros, 2m2m in all (pp. 5–6).

The nullspace: potentials#

Think of x=(x1,x2,x3,x4)x = (x_1, x_2, x_3, x_4) as potentials at the nodes (transcript, p. 7). Then AA computes the potential differences across the edges (p. 7):

Potential differences
Ax=(x2−x1x3−x2x3−x1x4−x1x4−x3)Ax = \begin{pmatrix} x_2 - x_1 \\ x_3 - x_2 \\ x_3 - x_1 \\ x_4 - x_1 \\ x_4 - x_3 \end{pmatrix}
In words

capital A x equals x two minus x one; x three minus x two; x three minus x one; x four minus x one; x four minus x three

These all vanish exactly when the potentials are equal, so (p. 8)

Nullspace of A
N(A)={ c(1111) },dim N(A)=1N(A) = \left\{\, c\begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} \,\right\}, \qquad \text{dim}\, N(A) = 1
In words

capital N ( capital A ) equals c 1; 1; 1; 1, dim capital N ( capital A ) equals 1

Physically, potentials are determined only up to a constant: differences make current flow, and nothing moves if all potentials are equal, just as temperature can be measured from any zero point, or as an indefinite integral carries a +C+C (pp. 8–9). In practice one node is grounded, its potential set to zero; its column drops out, and the other three columns are independent (p. 9). So the rank is 3; any three columns are independent, so any node can be grounded (p. 10).

The left nullspace: Kirchhoff's current law#

ATy=0A^Ty = 0 is perhaps the most fundamental equation of applied mathematics (transcript, p. 10). ATA^T is 4×54 \times 5, and its nullspace has dimension m−r=5−3=2m - r = 5 - 3 = 2 (pp. 11–12). The picture (pp. 12–13): potentials xx give potential differences e=Axe = Ax; Ohm's law gives currents on the edges, y=Cey = Ce, where CC holds the conductances (one over the resistances); and ATy=0A^Ty = 0 is Kirchhoff's current law (p. 13). Written out (pp. 14–15):

Kirchhoff's current law
ATy=0:−y1−y3−y4=0,y1−y2=0,y2+y3−y5=0,y4+y5=0A^Ty = 0: \qquad -y_1 - y_3 - y_4 = 0, \quad y_1 - y_2 = 0, \quad y_2 + y_3 - y_5 = 0, \quad y_4 + y_5 = 0
In words

capital A ^ capital T y equals 0: minus y one minus y three minus y four equals 0, y one minus y two equals 0, y two plus y three minus y five equals 0, y four plus y five equals 0

Each equation belongs to a node and says current in equals current out: a balance, a conservation law; charge does not pile up at the nodes (pp. 14–15). Elimination on ATA^T would end in a zero row, as the rank is 3 (pp. 15–16). But the solutions can be found by thinking about the graph: send one unit of current around a loop (pp. 16–17):

Loop currents
y=(11−100),y=(001−11)y = \begin{pmatrix} 1 \\ 1 \\ -1 \\ 0 \\ 0 \end{pmatrix}, \qquad y = \begin{pmatrix} 0 \\ 0 \\ 1 \\ -1 \\ 1 \end{pmatrix}
In words

y equals 1; 1; minus 1; 0; 0, y equals 0; 0; 1; minus 1; 1

These two are a basis of N(AT)N(A^T). Current around the big outer loop, (1,1,0,−1,1)(1, 1, 0, -1, 1), also satisfies the law, but it is their sum: on edge 3 the two currents cancel (pp. 17–18).

The row space and trees#

The row space of AA has dimension 3 (transcript, p. 18). The first three columns of ATA^T are not independent, since they come from a loop; the pivot columns are 1, 2 and 4, so edges 1, 2 and 4 give independent rows (p. 19). Those three edges connect all four nodes without a loop: such a graph is a tree (pp. 19–20). Dependencies come from loops.

Euler's formula#

The dimension count for N(AT)N(A^T) is a count of loops (transcript, pp. 20–21). With r=n−1r = n - 1 (one dependency among the columns, the constant vector):

Loops and Euler's formula
loops=dim N(AT)=m−r=edges−(nodes−1)  ⇒  nodes−edges+loops=1\text{loops} = \text{dim}\, N(A^T) = m - r = \text{edges} - (\text{nodes} - 1) \;\Rightarrow\; \text{nodes} - \text{edges} + \text{loops} = 1
In words

loops equals dim capital N ( capital A ^ capital T ) equals m minus r equals edges minus the quantity nodes minus 1, which gives nodes minus edges plus loops equals 1

Euler's formula holds for every connected graph (Strang says every graph; a graph in several separate pieces has more constant vectors in N(A)N(A), and the right-hand side becomes the number of pieces): points, lines and areas, of dimension 0, 1 and 2 (p. 21). Here 4−5+2=14 - 5 + 2 = 1; Strang draws another graph with 5 nodes, 7 edges and 3 loops: again 5−7+3=15 - 7 + 3 = 1 (pp. 21–22). Linear algebra proves a fact of topology (p. 21).

The basic equation of applied mathematics#

Adding outside current sources ff at the nodes (batteries in the edges would be the other way to drive the network) puts a right-hand side into the current law (transcript, pp. 22–23). The three steps combine (pp. 22–23):

The framework
e=Ax,y=Ce,ATy=f⇒ATCAx=fe = Ax, \qquad y = Ce, \qquad A^Ty = f \qquad \Rightarrow \qquad A^TCAx = f
In words

e equals capital A x, y equals capital C e, capital A ^ capital T y equals f which gives capital A ^ capital T capital C capital A x equals f

This is the equilibrium problem, with no time and no Newton's law, and solving it is the basic task of numerical linear algebra (p. 24). Strang's closing question: what is special about ATAA^TA? It is always symmetric (p. 24). (Strang's symbols are EE for the potential differences and FF for the sources; lowercase is used here. With this AA, AxAx is the rise in potential along each arrow, while current flows downhill; Strang leaves the minus sign out, and so does this page.)

Worked example

A square network of your own

Four nodes form a square with edges 1→21 \to 2, 2→32 \to 3, 3→43 \to 4 and 4→14 \to 1. (a) Write AA, find its rank and a basis of N(AT)N(A^T), and check Euler's formula. (b) For potentials x=(3,1,0,0)x = (3, 1, 0, 0), find AxAx and add up its entries. Why is the sum 0?

(a) Matrix and subspaces

A=(−11000−11000−11100−1)A = \begin{pmatrix} -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ 0 & 0 & -1 & 1 \\ 1 & 0 & 0 & -1 \end{pmatrix}. N(A)N(A) is still the constant vectors, so r=4−1=3r = 4 - 1 = 3, and dim N(AT)=4−3=1\text{dim}\, N(A^T) = 4 - 3 = 1: one loop, with current y=(1,1,1,1)y = (1, 1, 1, 1) all the way round. Euler: 4−4+1=14 - 4 + 1 = 1.

(b) Differences around a loop

Ax=(1−3,0−1,0−0,3−0)=(−2,−1,0,3)Ax = (1 - 3, 0 - 1, 0 - 0, 3 - 0) = (-2, -1, 0, 3), which adds to 0. Adding the entries is yTAxy^TAx with the loop current y=(1,1,1,1)y = (1, 1, 1, 1), and yTA=0Ty^TA = 0^T: going round a loop, the potential differences cancel.

Summary#

  • The incidence matrix of a graph has one row per edge (−1-1, +1+1) and one column per node; it is sparse and structured.
  • AxAx = potential differences; N(A)N(A) = constant potentials; rank n−1n - 1 for a connected graph.
  • ATy=0A^Ty = 0 is Kirchhoff's current law; its solutions are loop currents, and dim N(AT)\text{dim}\, N(A^T) is the number of independent loops.
  • Independent rows form a tree. Euler: nodes − edges + loops = 1.
  • e=Axe = Ax, y=Cey = Ce, ATy=fA^Ty = f give ATCAx=fA^TCAx = f; ATAA^TA is symmetric.

Symbols on this page

Show the 26 symbols used here
→\to arrow.
Goes to (tends to), or becomes. Say it: “goes to”.
⇒\Rightarrow implies.
Implies: what follows is a consequence of what came before. Say it: “which gives”.
×\times times.
Times (multiplication). Between two vectors: the cross product. Say it: “times”.
cc c.
The common value of constant potentials. Say it: “c”.
TT T.
As a superscript: the transpose. Say it: “capital T”.
xx x.
The vector of potentials at the nodes. Say it: “x”.
yy y.
The vector of currents on the edges. Say it: “y”.
nn n.
The number of nodes (columns of A). Say it: “n”.
ee e.
The vector of potential differences across the edges, e = Ax. Say it: “e”.
mm m.
The number of edges (rows of A). Say it: “m”.
ff f.
The vector of current sources at the nodes. Say it: “f”.
FF F.
Strang's letter for the current sources. Say it: “capital F”.
rr r.
The rank of A. Say it: “r”.
AA A.
The incidence matrix: one row per edge, one column per node. Say it: “capital A”.
CC C.
The diagonal matrix of conductances (one over the resistances), in Ohm's law y = Ce. Say it: “capital C”.
NN N.
As in N(A): the nullspace. Say it: “capital N”.
EE E.
Strang's letter for the potential differences. Say it: “capital E”.
x1x_{1} x 1.
The potential at node 1. Say it: “x one”.
x2x_{2} x 2.
The potential at node 2. Say it: “x two”.
y1y_{1} y 1.
The current on edge 1. Say it: “y one”.
y2y_{2} y 2.
The current on edge 2. Say it: “y two”.
x4x_{4} x four.
The potential at node 4. Say it: “x four”.
x3x_{3} x three.
The potential at node 3. Say it: “x three”.
y3y_{3} y three.
The current on edge 3. Say it: “y three”.
y4y_{4} y four.
The current on edge 4. Say it: “y four”.
y5y_{5} y five.
The current on edge 5. Say it: “y five”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 38 words used here

New here

incidence matrix.
The matrix of a graph, with one row for each edge and one column for each node, recording where each edge starts and ends.
loop.
In a graph or network, a closed path of edges that returns to where it started.
sparse.
Of a matrix: having mostly zero entries, so it can be stored and used much faster than a full one.
Kirchhoff's current law.
The rule that at any junction of a circuit or network, the total current flowing in equals the total flowing out.
tree.
A graph that connects all its nodes without any loop.
Euler's formula.
For a connected graph: the number of nodes, minus the number of edges, plus the number of independent loops equals 1.

Also used

matrix.
A rectangular table of numbers, which acts on vectors to give new ones and so describes a linear change of coordinates. Explained in Planes through three points, and matrices.
linear.
Of a map, operator or equation: respecting sums and multiples, so that L(au + bv) = aL(u) + bL(v). Explained in The geometry of linear equations.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
graph.
A set of points, called nodes, some of which are joined by lines, called edges: a network, not a curve. Explained in Matrix spaces, rank one and small-world graphs.
four fundamental subspaces.
The column space, nullspace, row space and left nullspace of a matrix, whose dimensions are all fixed by its rank. Explained in The four fundamental subspaces.
node.
A point of a graph, in the sense of a network of points joined by lines (edges). Explained in Matrix spaces, rank one and small-world graphs.
edge.
In a graph or network, a connection between two nodes, drawn as a line or an arrow. Explained in Matrix spaces, rank one and small-world graphs.
indefinite integral.
The family of all antiderivatives of a function, written ∫ f(x) dx = F(x) + c with an arbitrary constant c. Explained in Differentials and antiderivatives.
grounded.
Connected to the earth, or to a point held at zero potential, so the potential there is fixed at zero. Explained in Electric charge.
rank.
The number of independent columns of a matrix, which always equals the number of independent rows. Explained in Similar matrices and the Jordan form.
nullspace.
All the vectors x that a matrix sends to zero, that is, all solutions of Ax = 0. Explained in Column space and nullspace.
dimension.
The number of vectors in any basis of a vector space or subspace. Explained in Independence, basis and dimension.
Ohm's law.
The rule that the current through a conductor equals the voltage across it divided by its resistance. Explained in Current, resistance and Ohm's law.
resistance.
How strongly something opposes an electric current: the voltage across it divided by the current through it, measured in ohms. Explained in Current, resistance and DC circuits.
conserved.
Keeping the same total value as time passes, as energy and momentum do when nothing outside changes them. Explained in Conservation of energy.
elimination.
Solving equations by subtracting multiples of one from another until each unknown can be found in turn. Explained in The geometry of linear equations.
basis.
A set of independent vectors from which every vector in a space can be built, in exactly one way, as a combination. Explained in Independence, basis and dimension.
row space.
All the vectors that can be made by combining the rows of a matrix; it is the column space of its transpose. Explained in Matrix multiplication and inverse matrices.
pivot column.
A column of a matrix that contains a pivot after elimination; the matching columns of the original matrix form a basis for its column space. Explained in Column space and nullspace.
vector.
A list of numbers written as a column, or more generally anything that can be added and multiplied by numbers. Explained in Orthogonal vectors and subspaces.
topology.
The branch of mathematics that studies the properties of shapes that survive stretching and bending without tearing, such as having holes. Explained in Simply connected regions.
equilibrium.
A state that does not change by itself, because the influences acting on it balance. Explained in Newton's first law: inertia.
symmetric.
Unchanged by some swap, reflection or turn; for an expression in two quantities, unchanged when they are exchanged. Explained in Introduction to Fourier series.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
model.
A simplified description of a real system, usually in equations, that keeps what matters and leaves out the rest.
arbitrary.
Free to be chosen as one likes; any choice gives a correct result.
vanish.
To become zero; sometimes, of a fixed point or solution, to stop existing.
up to a constant.
Apart from a constant (or a sign, factor or phase): the two agree once that one difference is allowed for.
in practice.
In reality, as things are actually done or measured, rather than in theory.
drops out.
Disappears from an equation, usually because it cancels or appears on both sides.
satisfy.
To make an equation or condition true.
numerically.
In terms of actual numbers rather than symbols; often worked out step by step, by computer, instead of from an exact formula.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

Pages that build on this

Practise

Check your understanding

  1. A connected graph has 6 nodes and 9 edges. How many independent loops does it have?
  2. What is in the nullspace of the incidence matrix of a connected graph?
  3. What does Kirchhoff's current law ATy=0A^Ty = 0 say?
0 of 3 answered

Flashcards

1 / 4