One difference of squares from two. Posteriors with Gaussians.
\( (a-x)^2 + (x-b)^2 \)

This expression appears when dealing with posterior probabilities for the mean parameter of a Gaussian distribution. [Can you remember how?]
Minimum at \( x = \frac{a + b}{2} \)
Let \( a < b \) and define \( d=b - a \). If \( x \) is constrained to be between \( a \) and \( b \), then the expression is maximized when \( x=a \) or \(x=b \). The maximum value is \( d^2 \). If \( x \) is not constrained to \( [a, b] \), then the value of the expression can grow unbounded. The expression is minimized when \( x=\frac{d}{2} \). Let \( h=\frac{d}{2} \) be the half-width of the interval. When \( x \) is at the midpoint, \( x=a + h \), then the expression becomes:
If you increase \( x \) slightly, \( x \to x + \varepsilon \), then the expression would become:
The expression increases in value. It was indeed minimized at the midpoint when \( x = a + h \), taking the value \( 2h^2 = \frac{d^2}{2} \). Visualising the larger square \( (a-b)^2\) containing two quarter-sized \( h^2\) squares maybe help intuition.
From two squares to one square
The expression:
can be rewritten as one square involving \( x \):
Here again we see that the expression is minimized when \( x = \frac{a + b}{2} \), and the minimum value is \( \frac{(a - b)^2}{2} \).