The following code implements matrix arithmetic:
Clear["Global`*"]
Unprotect[Power];
Power[0, 0] = 1;
Protect[Power];
Unprotect[Dot];
Dot[x_?NumberQ, y_] := x y;
Protect[Dot];
Matrix /: Matrix[x_?MatrixQ] :=
First[First[x]] /; x == First[First[x]] IdentityMatrix[Length[x]];
Matrix /: Dot[Matrix[x_], Matrix[y_]] := Matrix[x . y];
Matrix /: Matrix[x_] + Matrix[y_] := Matrix[x + y];
Matrix /: x_?(Head[#] != Matrix &) + Matrix[y_] :=
Matrix[x IdentityMatrix[Length[y]] + y];
Matrix /: x_?NumericQ Matrix[y_] := Matrix[x y];
Matrix /: Matrix[x_]*Matrix[y_] := Matrix[x . y] /; x . y == y . x;
Matrix /: Power[Matrix[x_ ?MatrixQ], y_?NumericQ ] :=
Matrix[MatrixPower[x, y]];
Matrix /: Power[Matrix[x_?MatrixQ], Matrix[y_?MatrixQ]] :=
Exp[Matrix[y] . Log[Matrix[x]]];
Matrix /: Im[Matrix[x_?MatrixQ]] := Matrix[Im[x]];
Matrix /: Re[Matrix[x_?MatrixQ]] := Matrix[Re[x]];
Matrix /: Arg[Matrix[x_?MatrixQ]] := Matrix[Arg[x]];
Matrix /: Dot[Matrix[A_?SquareMatrixQ], Matrix[B_?SquareMatrixQ]] :=
Matrix[KroneckerProduct[A,
IdentityMatrix[LCM[Length[A], Length[B]]/Length[A]]] .
KroneckerProduct[B,
IdentityMatrix[LCM[Length[A], Length[B]]/Length[B]]]]
$Post = FullSimplify[# /.
f_[args1___?NumericQ, Matrix[mat_], args2___?NumericQ] :>
Matrix[MatrixFunction[f[args1, #, args2] &, mat]]] &;
But the output gives expressions like Matrix[{{0,1/2},{1/2,0}}]. How can I format output to MatrixForm? Adding the line $PrePrint=MatrixForm does not help.

