# Global assumption for unit trace

I am specifying a general two-dimensional density matrix:

ρ1 = {{Abs[α]^2, α*Conjugate[β]}, {Conjugate[α]*β, Abs[β]^2}};


I want Mathematica to recognise that the trace of the above matrix is 1. How do I specify a global assumption for this? I tried looking up the appropriate syntax of \$Assumptions, but could not find anything useful.

If the density matrix is defined as

m[a_, b_] := {{Abs[a]^2, a Conjugate[b]}, {Conjugate[a] b, Abs[b]^2}}


then it is possible to define an UpValue for symbol m, using UpSetDelayed:

Trace[m[a_, b_]] ^:= 1


Now, simply evaluating

Trace[m[a,b]]


produces

1


Also, evaluating something like 3.1 Trace[m[x,y]] + 0.1 evaluates to 3.2 as expected.

• Thanks! I had one more doubt. In case I specify the normalisation condition directly Abs[a]^2+Abs[b]^2 ^:=1, Mathematica gives a message which says that tag power is protected. Why does this happen? Jan 2, 2018 at 14:05
• assuming h[x] stands for a valid expression in x, f[x_]:=h[x] associates the rhs with the symbol f (see DownValues); on the other hand, f[g[x_]]^:=h[x] associates h[x] with symbol g (not f as one might expect-that's an UpValue for g); evaluate Abs[a]^2 + Abs[b]^2 // FullForm; verify that Power is placed where g is in the example above; Power has attribute Protected which doesn't allow altering the rules defined for it; usingTrace might be a better choice Jan 2, 2018 at 14:33