Lecture 12 · Graphs, Networks and Correlation Matrix
Use correlation matrices to describe graphs and networks, and understand loops, potentials and Kirchhoff's laws.
On this page
Graphs, networks, incidence matrices | Gilbert Strang | MIT 18.06 Linear Algebra
Lecture 12 / Total 35 Lectures |Part 1 · Elimination and Vector Spaces
Video of this lecture: Bilibili p12 · Graphs, networks and correlation matrices ↗(47:57)| MIT OCW official page ↗
Illustration: MIT OCW 18.06SC official lecture summary (CC BY-NC-SA 4.0) and Bilibili classroom video frames (time stamped), about 10 frames per lecture.
Introduction to this lecture
The matrices used in the first eleven lectures were mostly written temporarily to teach concepts. Real linear algebra doesn’t look like this: matrices in engineering and science come from specific problems, with clear structures, and users rely on these structures to read the answers. This lecture gives a discrete version of one of the most important models in applied mathematics——Figure (graph), and derived from the graph correlation matrix (incidence matrix). Each row of it has only two non-zero elements, and the relationship between rows corresponds to the loop(loop).
The main line is to correspond the physical quantities on the diagram to the four basic subspaces one by one. Taking the circuit as an example, what is placed on the node is potential (potential), next to it is Potential difference (potential difference) and current (current). correlation matrix Convert the node potential into the potential difference on the edge; The solution of shows that raising all potentials by a constant at the same time will not change the difference on any side, so The null space of is one-dimensional. And That’s it Kirchhoff’s current law (Kirchhoff’s current law, KCL), which requires that the inflow of each node is equal to the outflow, and the solution space is formed by the circulation on the loops.
So the real conclusion of this lecture is a comparison table: the null space corresponds to the electric potential that “can only be determined to differ by a constant”, the left null space corresponds to the current that “flows around the loop and does not accumulate charges at the nodes”, and the combination of rank, number of nodes and number of edges gives Euler’s formula (Euler’s formula). The last section strings the three-level relationships into a balanced equation .

MIT OCW Official Lecture Notes Summary Page 1/4 (18.06SC Lecture 12 Summary, CC BY-NC-SA 4.0).
1. Graph, edge and association matrix
Pictured by node (node) with side (edge) composition. take nodes, number , and Edge. Before writing a matrix, you must first set a direction for each edge: the direction is artificially specified and is only used to determine the sign - the current flows along the arrow to be positive, and if it flows against it, it is negative. The five edges are taken as follows: edge 1 goes from node 1 to node 2, edge 2 goes from 2 to 3, edge 3 goes from 1 to 3, edge 4 goes from 1 to 4, and edge 5 goes from 3 to 4.
correlation matrix The rows correspond to edges and the columns correspond to nodes, which is matrix. Each row is non-zero at only two endpoints of this edge: tail Node filling , head Node filling , the remaining positions are . So
There are exactly two non-zero elements in each row, and the total number of non-zero elements is . The larger the graph, the larger the matrix, but almost all of them are zeros. Such a matrix is called sparse matrix (sparse matrix). This type of matrix is not compiled casually: links between web pages around the world, phone calls, and relationships between people can all be drawn into diagrams and then written into such a matrix, and the structure of the matrix is the entrance to problem solving. The web graph is the most typical one: each web page is a node, each hyperlink is an edge, the matrix is too large to be written down at all, but it is equally sparse, and its null space and left null space also need to be asked.
The grid is just one interpretation of a correlation matrix. The same matrix can describe a water network—the flow of water or oil—or a structure, such as the design of a bridge or a dome. The quantities on the nodes are replaced by water pressure, temperature or displacement, the quantities on the edges are replaced by flow or internal force, and the matrix remains unchanged. After getting such a matrix, the four questions to ask are still the same as in the previous lectures: null space, column space, row space, and left null space. The only difference in this lecture is that these four answers can be read directly from the picture without elimination.
put Multiply it by a vector and see what it computes. Set , and interpret the components as potentials on the four nodes, then
The result is a five-dimensional vector whose five components are the differences in electric potentials at each of its five sides. That is to say, Convert “quantity on nodes” to “difference on edges”. This is what an association matrix is all about, and where it gets its name: it records which two nodes each edge is connected to.

Video 00:04:48 | Approximately corresponding to Section 1 “1. Graph, Edge and Association Matrix”.
2. Null space: The electric potential is only determined to a constant difference.
Now for the most basic question: Are the four columns of are linearly independent? Asking equivalently, Is there any non-zero solution? Write the equation line by line:
The first equation gives , the second equation gives , the fourth formula gives , then all four components are equal, and the remaining two equations are automatically established. The null space is therefore
In one dimension, the basis is an all-1 vector. Four columns are linearly related, and the all-1 vector is the set of coefficients that are not all zero—— The four columns of add up to a zero vector. If the four columns are linearly independent, there should only be zero vectors in the null space; now that we have really found a non-zero solution, the four columns must be related, and the rank will not be 4. The question “Are the four columns independent?” was translated into “What else is there besides the zero vector in the null space?” This is the same perspective that has been used repeatedly in the previous lectures.
The physical meaning is very straightforward: when the electric potentials of the four nodes are completely equal, the electric potential differences on the five edges are zero, and nothing will flow. On the other hand, the only thing the graph can determine is the potential difference; add the same constant to the four potentials at the same time , none of the differences on the five sides remains unchanged. Therefore, the electric potential is only determined to differ by a constant, which is the same as the one after the indefinite integral It’s the same thing - to fix the constant, you have to specify an additional starting point. Temperature is the same: heat flows from high temperature to low temperature. When the temperature is the same everywhere, there is no heat flow. The zero point of temperature can be specified arbitrarily, whether using degrees Celsius or absolute temperature scale, the difference is only a constant. The engineering approach is to put a certain node ground (ground), that is, its electric potential is determined as , for example let . The effect of grounding on the matrix is to delete the corresponding column: the remaining three columns are linearly independent, and the degree of freedom of “simultaneously raising a constant” disappears.
So the rank is . Any three of the four columns are linearly independent, and the only dependence is the one given by the all-1 vector; in other words, any three of the four potentials are a set of useful independent variables, and the fourth one is redundant. Grounding is to fix this redundant quantity. column space It is formed by the potential difference vectors on five edges, and the dimension is equal to rank 3, but A three-dimensional subspace in: Starting from a node potential vector, going around any loop, the differences in each segment cancel out end-to-end. This constraint compresses the achievable potential difference into three dimensions.

Video 00:10:17 | Approximately corresponding to section 2 “2. null space: the electric potential is only determined to a constant difference”.

MIT OCW Official Lecture Notes Summary Page 2/4 (18.06SC Lecture 12 Summary, CC BY-NC-SA 4.0).

Video 00:18:13|Approximately corresponding to section 2 “2. null space: the electric potential is only determined to a constant difference”.
3. Transposition and Kirchhoff’s current law
put Transpose, get matrix , its rows correspond to nodes and columns correspond to edges:
Set are the currents on the five sides. Equation Expand into four equations:
The first line only involves edges 1, 3, and 4, and these three edges happen to originate from node 1, so it says “the sum of the currents flowing out of node 1 is zero.” The second row belongs to node 2: edge 1 comes in, edge 2 goes out, and in equals out. The third row belongs to node 3: inflow, outflow. The fourth row belongs to node 4: the arrows of edges 4 and 5 both point to it, and the two incoming currents must cancel each other out.
The sum of these four equations is Kirchhoff’s current law: The inflow at each node is equal to the outflow, and the charge does not accumulate at the node. It is the discrete form of the conservation law, and It can be called the most basic equation in applied mathematics. The dimensions can be written down without having to solve the equation: is The matrix of There are pivot columns, leaving free columns, each free variable gives a special solution, so
The same thing is true from the perspective of the process of elimination. There are only three pivots, and when the elimination proceeds to the last row, the entire row must be reduced to zero - four rows and a rank of three, indicating that one row is a combination of the other three rows. The simplest form is then given to each of the two free variables to a special solution, and these are interpreted back to the graph, and what is obtained is the circulation on the two loops.
There is no need to perform elimination to find the basis of this two-dimensional space. You can figure it out by looking at the picture: the current that does not accumulate at any node can only be the current that circulates along the loop. Let 1 amp go along the loop Flow: On edge 1 , on edge 2 , the arrow on side 3 is , opposite to the flow direction, so , the other two sides are zero, we get
Substitute the four equations and check one by one: Node 1 , on node 2 , on node 3 , on node 4 , all passed. The second basis vector is along the loop Flow in a circle: , the rest are zero, that is .
The outermost loop This is also the solution: . But it is equal to the sum of the first two vectors - along the loop first Flow in a circle, then follow the loop When flowing in one circle, the two currents on common edge 3 have opposite directions and exactly cancel each other, and the remaining current is the current flowing along the outer circle. So it’s not independent, the basis only requires two vectors. Hence the “circulation space”: its dimension 2 is exactly the number of independent loops in this graph.
4. Trees, pivot columns and Euler’s formula
Rank is 3, so the row space The dimension of is also 3: only three of the five row vectors corresponding to the five edges are independent. Looking back at the first three lines, The first row plus the second row is exactly equal to the third row, that is . And edges 1, 2, and 3 are connected end to end, forming a loop. ——The rows corresponding to the edges of the loop are linearly related. More precisely, take out the combined coefficients of the three rows and write them as vectors , which happens to be the first circulation basis vector obtained in the previous section; the dependency between rows is the loop, which are two ways of saying the same thing.
in Perform elimination on the above, the pivot columns are columns 1, 2, and 4, corresponding to edges 1, 2, and 4. These three edges connect all four nodes but do not contain any loops themselves - such a graph is called tree (tree). A tree with four nodes has exactly three edges, one less than the number of nodes. This is the smallest structure that is connected and has no loops; as long as one more edge is added, a loop will inevitably be formed, and a certain row will inevitably be a combination of the other rows. This is the geometric interpretation of rank equal to the number of nodes minus one.
In turn, look at the free columns: columns 3 and 5, that is, sides 3 and 5. Each edge complement tree closes exactly one loop, and the number of independent loops is therefore the number of free columns. This number has a concrete shape on the diagram - it is two “windows”.
Convert the dimensionality formula from the previous section to Combined, they can calculate something that seems to have nothing to do with linear algebra. Let the number of independent loops be , then
Move the item and get it
Check with the previous example: . Try another graph: 5 nodes, 7 edges, 3 independent loops, . this is Euler’s formula. Read it in terms of dimensions: nodes are zero-dimensional objects, edges are one-dimensional and connect two nodes, loops are two-dimensional and enclose an area, so The number is exactly “point minus edge plus surface”, which is always equal to 1 for any connected graph. Euler’s formula is a topological fact, but here it is proved using the rank formula.

Video 00:31:10 | Approximately corresponding to Section 4 “4. Trees, Pivot Sequences and Euler’s Formula”.

MIT OCW Official Lecture Notes Summary Page 3/4 (18.06SC Lecture 12 Summary, CC BY-NC-SA 4.0).

Video 00:37:35 | Approximately corresponding to Section 4 “4. Trees, Pivot Sequences and Euler’s Formula”.
5. Framework of applied mathematics:
When you connect the three levels of relationships, you get a complete picture.
The first step is : The node potential becomes the potential difference on the five edges. . The second step is Ohm’s law (Ohm’s law): The current on an edge is proportional to the potential drop at both ends of the edge, and the proportional coefficient is the Conductance (conductance), which is the reciprocal of resistance. Written as a matrix it is , among which It’s level five diagonal matrix (diagonal matrix), the diagonal elements are the conductances of each edge - these numbers are physical constants and have nothing to do with how the graph is connected. The third step is : When an external current is injected into the node, the right end of KCL is no longer zero, Record the externally injected current at each node.
Three steps are put together to put and Substituting in order, we get
This is the entire network balance (equilibrium) equation in the state. Time is not part of it, and Newton’s laws are not part of it. The question is just how the current is distributed when everything settles down. This set of equations is not specific to circuits: whenever there is a conserved quantity flowing in each channel, there must be such a balance equation to find. Circuits, pipe networks, and static structures all fall into the same pattern. The actual solution of such equations is one of the core tasks of numerical linear algebra and can be very large; The sparse structure of is exactly what the algorithm can use.
External forces can be added from two places and fall on different layers: adding battery, what changes is the potential difference layer; connect the current source, what changes is the current balance layer, that is is no longer zero. The former falls between the first and second steps, and the latter falls on the right end of the third step.
What is noteworthy about this set of equations is that, with are present at the same time. The matrix in the real problem is rectangular, and the rows and columns do different things, so a matrix needs to be equipped with a transpose - this is why we insist on calculating all four subspaces in the previous lectures.
One last observation. It must be symmetric matrix (symmetric matrix), because
In the same way, when When is the diagonal matrix composed of the conductance of each side, It’s also symmetrical. The network equation finally falls on a symmetric matrix, which will be encountered again and again later.

Video 00:43:10 | Approximately corresponding to Section 5 “5. Framework of Applied Mathematics: “Nearby.

MIT OCW Official Lecture Notes Summary Page 4/4 (18.06SC Lecture 12 Summary, CC BY-NC-SA 4.0).
Summary of this lecture
- A graph is composed of nodes and edges; after specifying the direction for each edge, you can write of correlation matrix: The row corresponds to the edge, fill in the end node of the edge , fill in the head node . This example , , there are only two non-zero elements in each row, the total number of non-zero elements .
- Calculates the potential difference across each edge, where is the electric potential vector at the node.
- The one-dimensional null space of is spanned by all 1 vectors: the electric potential can only be determined up to a constant difference. ground (make a , delete this column) can determine the dead benchmark; therefore , any three of the four columns are linearly independent.
- The rows correspond to nodes, That’s it Kirchhoff’s current law: The inflow of each node is equal to the outflow, and the charge does not accumulate at the node.
- , the basis is the circulation on two independent circuits with ; Circulation of the outermost large loop It is the sum of the two and therefore not independent.
- A loop causes corresponding rows to be linearly related: edges 1, 2, and 3 form a loop, so , the combination coefficient is exactly the circulation vector.
- The pivot columns are columns 1, 2, and 4, corresponding to a loop-free node containing all four nodes. tree;Rank Represents the smallest connected structure with one less edge than node.
- Euler’s formula ( is the number of independent circuits) is given by with launch, verify , another example .
- Three-layer equation of the network: (potential difference), (Ohm’s law, is the conductance diagonal matrix), (KCL with current source), which adds up to .
- It is always a symmetric matrix; When it is a diagonal matrix Also symmetrical.
keywords
| English | Chinese | One sentence explanation |
|---|---|---|
| graph | Figure | A discrete structure composed of nodes and edges, one of the most basic models of applied mathematics |
| node | node | Points on the graph are the locations of state quantities such as electric potential and temperature. |
| edge | side | The line connecting two nodes, the channel through which current and flow pass |
| incidence matrix | correlation matrix | Rows correspond to edges, columns correspond to nodes, and the tail is filled in , head-end filling matrix |
| sparse matrix | sparse matrix | A matrix with few non-zero elements. The correlation matrix has only two non-zero elements in each row. |
| potential | potential | Only the potential difference has physical meaning for the state quantity on the node. |
| potential difference | Potential difference | The difference in potential between the two ends of a side is exactly weight |
| current | current | The flow rate on the edge is related to the potential difference by Ohm’s law. |
| Kirchhoff’s current law | Kirchhoff’s current law | The inflow of each node is equal to the outflow, written as |
| loop | loop | A string of edges connected end to end, corresponding to The row depends on the the null space of |
| tree | tree | A connected graph without loops, nodes have exactly strip edge |
| Euler’s formula | Euler’s formula | , the number of nodes minus the number of edges plus the number of independent loops is always |
| Ohm’s law | Ohm’s law | The current is equal to the conductance multiplied by the potential drop, which is |
| conductance | Conductance | The reciprocal of resistance, the coefficient of proportionality in Ohm’s law |
| equilibrium | balance | A state in which neither time nor acceleration appears, and each quantity has stabilized. |
Machine-assisted translation · Read Chinese original
