**Question**

The usual projection in $\mathbb{R}^n$ on a subspace can be defined as the point that minimizes the squared distance to the subspace. I'll call the Pythagorean theorem the easy fact that, given a point $x$, its projection $Px$ and another point $y$ in the subspace, $$ |x-y|^2 = |x - Px|^2 + |Px-y|^2 $$

An amazing fact to me is that, in a easy result (due to, I believe, Csiszar), the Kullback-Leibler divergence also obeys this Pythagorean theorem. The question is, is this an example of a more general phenomenon? Are there other interesting 'distance' functions that obey the Pythagorean theorem? Note that the KL divergence does not obey the triangle inequality. Besides the convergence of the alternating projection algorithm (see below), does this lead to any other interesting mathematics?

**Background**

I came to this question studying the "RAS" algorithm in economics. This algorithm takes a matrix and gives a matrix with prescribed row and column sums by alternatingly scaling the rows and columns to have the prescribed sums. Csiszar [1] showed that this algorithm is exactly the alternating projection algorithm in disguise, except replacing the $L^2$ projection with the KL distance (Csiszar calls these I-projections). The proof of convergence is almost identical to the usual one, making use of Pinsker's inequality. This beautiful fact led me to the question above.

[1] Csiszár, Imre. "I-divergence geometry of probability distributions and minimization problems." The Annals of Probability (1975): 146-158. https://www.jstor.org/stable/2959270?seq=1