# Normalizing a Matrix

Hi guys! This is a simple question, but I have to ask…

How do I normalize a Matrix?

I have searched on the WEB and saw a lot of different formulas to do this, and now I’m getting confused!

Can anyone explain this to me?

Thank you a lot!
Fernando

Fernando,

What do you expect to achieve by normalizing a matrix?

I know how to normalize vectors, but AFAIK there’s no such equivalent for matrices (they don’t have a ‘size’ that can be used to reduce its elements in such a way that this size becomes 1).
And ‘normalizing’ the individual rows or columns of a matrix results in another matrix with a not-so-obvious relation if any to the original matrix.

Jean-Marc

Thank JML!

Let me explain!

I’m trying to make my own function of gluProject.
In the Blue Book, there is a explanation in how to do that. I have extremely sure I did all the things were wrote there, but it didn’t work.

Then I think it is because I didn’t normalize my vectors (like you told me).

How DO I normalize then?

Thank you!
Fernando

To normalize a vector
v1=(x0,y0,z0)
d=sqrt(x0x0 + y0y0 + z0*z0)

x1=x0/d
y1=y0/d
z1=z0/d

this is your new normalized vector (x1,y1,z1)

hope that helps

Jeremy

Helped a lot, Thank you Jeeeez!

Hmmmmm, random guesses here…

vec normalised = vec / |vec|

so maybe
mat norm = mat/|mat|

saying that a matrix can;t have a size…
well
|mat| =determinant Mat

|mat| =determinant Mat

Hi!

We discussed that in math. I had the same idea once, too, and your equation above would have simplified a prove incredibly.
But…I´m sorry, |mat| is not defined (if I remember it correctly, at least it does not work like that)

Have a nice day
Batti

edit: But I maybe wrong

[This message has been edited by Batti (edited 06-05-2002).]

Actually, there are definitions for several
different matrix norms.

A norm must only satisfy 3 properties:

1. |A| > 0
2. |kA| = |k| |A|
3. |A+B| <= |A|+|B|

What I imagine you are really wanting to do is reorthogonalize the column vectors of a transformation matrix( which has become “unnormalized” by repeated multiplication).

If this is what you mean, look up “Gram-Schmidt orthogonalization”.

Hi!

So how is |mat| defined? If it really equals det mat, I´m gonna paint my teacher´s house green and eat his dog.
Never could I stand him.

There are several matrix norms, just like there are several for vectors. The simplest is the Frobenius norm which is just the sqrt of the sum of the squares for real-valued matrices. Some of the other norms are functions of the eigenvalues of the matrix. Haven’t seen one in terms of the determinant though.

Thank you for your help guys!

But I have a question…

What is the correct way?

this?
var = (x * x + y * y + z * z);
vector.x = vector.x / var;
vector.y = vector.y / var;
vector.z = vector.z / var;

or this?
vector.x = vector.x / vector.w;
vector.y = vector.y / vector.w;
vector.z = vector.z / vector.w;
(where ‘w’ is the forth item of vector)

I’m asking this because I’ve seem people using this two forms.

Thank you again
Fernando

The first is normalization. The second looks like it
is meant to be perspective division.

Matrix norm:

A be a matrix.

|A| = max{|Ax| such that |x| == 1}

Here |x| and |Ax| is the vector norm.

I forget the name of this norm, but it is a pretty common one. I think it is the p-norm.

Only mathematicians care about such things. Vector norms are enough for GL.

Also, Fernando, the first norm is the vector norm. The second is normalizing from homogenous coordinates. Since the real world is only 3-d, only the first three matter, to some extent. However, if the fourth place is not 1 (can be made one by your second algorithm), the first three numbers are not correct.

[This message has been edited by nickels (edited 06-07-2002).]