# Generation of orthogonal matrices "close" to identity

Suppose I want to generate a $n \times n$ orthogonal matrix $H$ (that is, $H^T H=I$) but with the property that $1-e < (tr H)/n < 1+e$ for some pre-specified tolerance $e$. How can I do this? Ideally I would want them to have the Haar distribution (conditional on the trace restriction) but I would settle for any method that produces a "reasonable" distribution.

Two approaches I had in mind:

1) use of Givens rotations/Euler angles close to 0

2) (edited) using skew-symmetric matrices $L$ close to 0 and evaluating $\exp L$

NOTE: Possible applications include Bayesian estimation of covariance matrices.

• Do you mean $(1-e)n$ and $(1+e)n$ by chance? Or, something else? Mar 30 '12 at 16:12
• I like option (2) and believe it will be quite stable for $|\epsilon|\lt 1$--just look at how the terms in the power series decay. The issue is working out the correct probability distribution. For really small $\epsilon$ you can take it to be uniform (on the Lie algebra) but for larger values curvature will begin to matter, and then you have to work out the Jacobian of the exponential map, as done on MO for skew-symmetric matrices.
– whuber
Mar 30 '12 at 16:16
• Thanks whuber! I also think the exponential approach looks promising (and easy to implement!) Mar 31 '12 at 1:07