(* Scalar matrix : a diagonal matrix with a constant on the diagonal *)
Section ScalarMx.
Variable n : nat.
Fact scalar_mx_key : unit. Proof. by []. Qed.
Definition scalar_mx x : 'M[R]_n :=
\matrix[scalar_mx_key]_(i , j) (x *+ (i == j)).
Notation "x %:M" := (scalar_mx x) : ring_scope.

Lemma scalar_mx_is_scalar a : is_scalar_mx a%:M.
Fact mulmx_key : unit. Proof. by []. Qed.