A tree is a covariance matrix
Under Brownian motion a trait's change along each branch is independent of every other branch's, so two species' values covary by exactly the length of the path they share from the root. The tree is a covariance matrix, and its tips are arrows whose dot products are their shared history. The same fact makes the likelihood easy to compute without the matrix: Felsenstein's pruning algorithm turns the correlated tips into independent contrasts, one cherry at a time, and the answer does not depend on where the root is.
1 Shared history is covariance
A tip's value is the root's plus the change along every branch on its way down, and each branch adds its own independent change, with variance its length (times the rate, 1 here). So a tip's variance is its distance from the root, and two tips' covariance is the length of the path they share. Write each tip as an arrow with one axis per branch and the square root of that branch's length along it: two arrows' dot product is then the length they share, and the correlation is the cosine of the angle between them, as in the geometry of correlation.
The tips' covariance
The tips as arrows
Simulated tips
2 Moving the root
Brownian motion runs the same forwards and backwards, so the tips only tell us about the unrooted tree. Hang the same tree from another point, and the covariance matrix changes, since the paths now share different stretches, but the restricted likelihood, with the root's state integrated out, does not. That is Felsenstein's pulley principle. The ordinary likelihood, with the root's state set to its best estimate, does change: the closer the root is to a tip, the more precisely that tip pins the root down.
The likelihood wherever the root is
0 puts the root on the node itself.
3 Pruning, one cherry at a time
Two sister tips, a cherry, differ by their contrast, whose variance is the sum of their two branches and which is independent of everything else on the tree. Replace the cherry by its parent node, valued at the average of the two weighted by the other's branch, and lengthen the parent's branch by v₁v₂/(v₁ + v₂), the uncertainty of that average. Repeat until one node is left. The log-densities of the contrasts add up to the restricted log-likelihood, the same number as the multivariate normal density of the tips with the tree's covariance, without ever forming or inverting the matrix.
From covariance to contrasts
How it works
The likelihoods
For n tips with covariance C (times the rate σ²), the restricted log-likelihood integrates the root's state μ out against a flat prior: −½[(n − 1) log 2π + log|C| + log 1ᵀC⁻¹1 + rᵀC⁻¹r] for one trait with σ² = 1, where r is the tips' deviation from the root estimate μ̂ = 1ᵀC⁻¹x / 1ᵀC⁻¹1. Pruning gives the same sum one contrast at a time, and μ̂ is the value it leaves at the root, with variance 1/1ᵀC⁻¹1. The ordinary log-likelihood at μ̂ is the restricted one minus ½ log(2π σ² Var μ̂), which is why it moves with the root and the restricted one does not. Rooted at a tip, that tip's value is the root's state, observed, and the two coincide. A root edge adds its length to every entry of C.
Computing
The matrix's log-determinant and inverse come from its Cholesky factor; the pruning never forms a matrix. With several traits and a rate matrix Σ, each contrast is multivariate normal with covariance its variance times Σ, and the direct likelihood uses C ⊗ Σ; the API takes up to four traits. Simulated tips are drawn branch by branch with a seed, so a seed gives the same draws everywhere. A node with more than two children is pruned two at a time, as if joined by branches of length 0. The API provides the same computations.