What does Four Pillars and Double Entry conclude, in numbers, about “The Algebra of Location: Incidence Matrix, Null Space and the Closing Window”?
Answer: The program prints a basis of the null space; each line is an error that leaves every balance unchanged. In the first line T01 is understated by 45000 fen while T02 is overstated by 45000 fen. Both entries debit cash and credit customer deposits; one too small and one too large, they leave both accounts where they were. In the second line T01 and T09 are each overstated by 20000 fen; T01 receives a deposit and T09 refunds one, so overstating both by the same amount cancels in cash, in and out, and in deposits, credit and debit. The remaining three lines shift amounts between the two purchases, the two freight bills and two of the deposits.
Scope of the numbers: With runnable programs this book shows that a single-entry list contains no test of itself: on an illustrative day, leave out a balance payment of 1,500.00 yuan and the spreadsheet stays perfectly consistent; a gap appears only against the bank balance. Parameters are illustrative; all calculations are generated by the book's programs; the book is general analysis, not individualised accounting, tax or legal advice.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 01, 02, 09, 20000, 45000
| entries 12, accounts 9, touched 8, rank 7 | |
| invisible directions (null space) | 5 |
| each line: fen added to each entry's size, balances unchanged | |
| T01 | -45000 T02:+45000 |
| T01:+20000 T09:+20000 | |
| T03 | -96300 T10:+96300 |
| T05 | -3500 T11:+3500 |
| T01 | -30000 T12:+30000 |
| T01 +1/6 with T02 -2/9 moves accounts: none |
Show the full program
# Chapter 3. p31: balances see accounts, not entries: the cycle space.
# Model: the day of p12 as an incidence matrix M (rows = accounts,
# columns = entries, entry = its legs). Closing balances are
# b = opening + M x with x the all-ones vector. A vector of relative
# amount errors e changes every balance by M e, so errors with M e = 0
# are invisible to the trial balance and to every account-level match.
# Rank and a null-space basis are computed with exact fractions
# (Gauss-Jordan). Columns sum to zero, so rank <= touched accounts - 1.
from fractions import Fraction as F
ACCTS = ("CASH", "STOCK", "AR", "DEP", "REV", "COGS", "FX", "SHIP",
"CAP")
DAY = (
("T01", (("CASH", 60000), ("DEP", -60000))),
("T02", (("CASH", 45000), ("DEP", -45000))),
("T03", (("STOCK", 178560), ("CASH", -178560))),
("T04", (("FX", 1240), ("CASH", -1240))),
("T05", (("SHIP", 12000), ("CASH", -12000))),
("T06", (("DEP", 80000), ("AR", 150000), ("REV", -230000))),
("T07", (("COGS", 170000), ("STOCK", -170000))),
("T08", (("CASH", 150000), ("AR", -150000))),
("T09", (("DEP", 20000), ("CASH", -20000))),
("T10", (("STOCK", 96300), ("CASH", -96300))),
("T11", (("SHIP", 3500), ("CASH", -3500))),
("T12", (("CASH", 30000), ("DEP", -30000))),
)
def matrix():
m = [[F(0)] * len(DAY) for _ in ACCTS]
for c, (_, legs) in enumerate(DAY):
for a, amt in legs:
m[ACCTS.index(a)][c] = F(amt)
return m
def rref(m):
m = [row[:] for row in m]
pivots, r = [], 0
for c in range(len(m[0])):
p = next((i for i in range(r, len(m)) if m[i][c] != 0), None)
if p is None:
continue
m[r], m[p] = m[p], m[r]
piv = m[r][c]
m[r] = [x / piv for x in m[r]]
for i in range(len(m)):
if i != r and m[i][c] != 0:
f = m[i][c]
m[i] = [x - f * y for x, y in zip(m[i], m[r])]
pivots.append(c)
r += 1
return m, pivots
def null_basis(m):
red, piv = rref(m)
free = [c for c in range(len(m[0])) if c not in piv]
basis = []
for f in free:
v = [F(0)] * len(m[0])
v[f] = F(1)
for r, c in enumerate(piv):
v[c] = -red[r][f]
basis.append(v)
return basis
if __name__ == "__main__":
m = matrix()
touched = [a for a, row in zip(ACCTS, m) if any(row)]
_, piv = rref(m)
print("entries {}, accounts {}, touched {}, rank {}".format(
len(DAY), len(ACCTS), len(touched), len(piv)))
basis = null_basis(m)
print("invisible directions (null space) = {}".format(len(basis)))
print("each line: fen added to each entry's size, balances unchanged")
for v in basis:
terms = []
for i, x in enumerate(v):
if x != 0:
size = max(a for _, a in DAY[i][1])
terms.append("{}:{:+d}".format(DAY[i][0], int(x * size)))
print(" " + " ".join(terms))
e = [F(0)] * len(DAY)
e[0], e[1] = F(1, 6), F(-2, 9)
shift = [0] * len(ACCTS)
for r, row in enumerate(m):
for c in range(len(DAY)):
shift[r] += row[c] * e[c]
moved = [a for a, s in zip(ACCTS, shift) if s != 0]
print("T01 +1/6 with T02 -2/9 moves accounts: {}".format(
",".join(moved) if moved else "none"))Single source and citation
Fan, Y. (2026). The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers (Version 1.0.0), Chapter 3: The Algebra of Location: Incidence Matrix, Null Space and the Closing Window. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-318 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026318,
author = {Fan, Yafu},
title = {The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · What a Single-Entry List Cannot See: Conservation Tests Only Against a Count
- Chapter 2 · The Detection Matrix of Nine Error Types: What the Trial Balance Catches and What It Lets Through
- Chapter 4 · Exact Arithmetic: Integer Fen, an Exchange-Difference Account and Largest-Remainder Sharing
- Chapter 5 · Accounts for a Buying Agent: Four Pillars for Every Account and Seven Daily Invariants
- Chapter 6 · How Many Orders to Re-check Each Week: Discovery Sampling and Value Strata
- Chapter 7 · Eastern and Western Sources: the Song Four-Pillar Settlement and Pacioli's Three Books
- Chapter 8 · Closing the Loop: the Daily Close, the Four-Pillar Double-Entry Reconciler and a Pre-registered Test