# How to make a list/matrix out of an expression?

I would like to make a matrix out out of the following expression:

$$(\Omega^2 (2 d\theta^2 + d\phi^2 - d\phi^2 \cos(2 \theta) \coth(\chi)^2) + (2 d\Omega^2 + (2 d\theta^2 + d\phi^2 - 2 d\chi^2) \Omega^2) \textrm{csch}(\chi)^2)/(2 \Omega^2)$$

so that I get for the 11-components all terms that belong to $d\Omega^2$, for the 22-component all the terms belonging to $d\chi^2$, etc. (As there are no 'cross-terms', the matrix in this case should be diagonal). How do I go about this in Mathematica?

Code for copying:

(Ω^2 (2 dθ^2 + dϕ^2 - dϕ^2 Cos[2 θ] Coth[χ]^2) +
(2 dΩ^2 + (2 dθ^2 + dϕ^2 - 2 dχ^2) Ω^2) Csch[χ]^2)/(2 Ω^2)

• Please include the expression in Mathematica code for easy manipulation. Thanks – Mr.Wizard Aug 7 '13 at 13:58
• Of course, here you go: ([CapitalOmega]^2 (2 d[Theta]^2 + d[Phi]^2 - d[Phi]^2 Cos[ 2 [Theta]] Coth[[Chi]]^2) + (2 d[CapitalOmega]^2 + (2 d\ [Theta]^2 + d[Phi]^2 - 2 d[Chi]^2) [CapitalOmega]^2) Csch[[Chi]]^2)/(2 \ [CapitalOmega]^2) – user25477 Aug 7 '13 at 14:11
• You can edit your question to add such information. – Mr.Wizard Aug 7 '13 at 14:12

expression =   1/(2 Ω^2) (Ω^2 (2 dθ^2 + dϕ^2 - dϕ^2 Cos[2 θ] Coth[χ]^2) +

CoefficientArrays[expression, differentials][] // Normal // MatrixForm