# Trace Norm / Nuclear Norm: How to verify?

The nuclear norm is defined by this [from wikipedia]:

$$\|A\|_* = \text{trace} \left( \sqrt{A^*A} \right) = \sum_{i=i}^{\min\{m,n\}}\sigma_i(A)$$

I get the derivation of this equation. However, I wanted to test it in MATLAB. So used this script:

clc;
clear;
close all;

P = rand([3,4]);
PTP = P'*P;

%compute trace(P'*P)
B = sqrt(P'*P);
S1 = trace(B)

%Compute sum of sigma_i(P)
E = svd(P);
S2 = sum(E)

%Do the same for eigenvalues
E3 = sqrt(eig(P*P'));
S3 = sum(E3)


But for some reason, the values inside S1 and S2 does not match. I do not understand where I did wrong. Could anybody help?

• Welcome to the site by the way. It can be good to learn mathjax typesetting for this site. I helped you turn the wikipedia equation into mathjax code. I think there is a tutorial somewhere. math.meta.stackexchange.com/questions/5020/… – mathreadler Apr 9 '19 at 7:34

B = sqrt(P'*P);