  We explicitly compute the maximal Lyapunov exponent for a switched system on
$\mathrm{SL}_2(\mathbb R)$. This computation is reduced to the characterization
of optimal trajectories for an optimal control problem on the Lie group.
