Calculating angles between matrices

In summary, the conversation is about calculating angles between matrices and functions using the inner product. The usual formula for cos(theta) can be used for both cases, with the inner product defined as trace(A^T.B) for matrices and as an integral for functions. However, the usefulness of this angle in solving problems may vary.
  • #1
spicytaco
2
0
Hey all,

I was hoping someone could explain to me how to calculate the angle between matrices, ie. two square matrices

[ 2 0
0 -1]

and

[0 1
1 3^(1/2)]

under the inner product <A|B> = trace (A^TB)

Also, how would you go about determining an angle between x and y when they are functions, ie. x = f(x) = x^2 +2 and y=(g(x)=x^3 -7x, under the inner product below:

⟨f |g⟩ =
1
∫ f (x)g(x)dx.
−1

I already know how to determine angle using cos theta = (x^Ty)/ ||x|| ||y|| but does this only work for column and row matrices?
 
Physics news on Phys.org
  • #2
Any time you have an inner product, you can use it to define angles between elements using the usual formula:
[tex]
\cos\theta(a,b) = \frac{\langle a | b \rangle}{\sqrt{\langle a | a \rangle \langle b | b \rangle}}
[/tex]
This works equally well for your matrices and for your functions.

Whether that angle tells you anything useful for the problem you're trying to solve is another question. :)
 
  • #3
Thanks so much!
 
  • #4
For "vectors in space", two or three dimensions, you can use trigonometry to prove that the dot product of two vectors, u and v, are given by [itex]u\cdot v= |u||v|cos(\theta)[/itex] where |u| and |v| are the lengths of the two vectors and [itex]\theta[/itex] is the angle between them. For more abstract vector spaces, we define the length of a vector, v, to be [itex]\sqrt{<v, v>}[/itex] and the angle between u and v to be given by
[tex]cos(\theta)= \frac{<u, v>}{|u||v|}[/tex]
 
  • #5
In spicytaco's matrix example the angle is the same as the angle for the two vectors (2,0,0,-1) and (0,1,1, 3^1/2) in R^4 with usual euclidean norm.

(2,0,0,-1).(0,1,1,3^1/2) = 0 + 0 + 0 - 3^1/2

|(2,0,0,-1)| = 5^1/2
|(0,1,1,3^1/2)| = 5^1/2

so cos(theta) = (-3^1/2)/5 (theta ~= 110 degrees)

this is why the inner product is defined as trace(A^T.B), for nxn matrices you get R^(n^2) euclidean space with two vectors defined by joining the columns of A and the other by the columns of B.

For the functions example there isn't a "natural" analogy but the answer has been given above, you just plug in the formula for the inner product into the equation for cos(theta)
 
Last edited:

Related to Calculating angles between matrices

1. How do I calculate the angle between two matrices?

To calculate the angle between two matrices, you can use the dot product formula:
θ = cos-1((ATB) / (||A|| * ||B||))
where A and B are the two matrices and || || denotes the norm of the matrices. Alternatively, you can also use the arccosine of the cosine similarity between the two matrices.

2. What is the significance of calculating angles between matrices?

Calculating angles between matrices can provide insights into the relationship between the two matrices. It can be used to determine if two matrices are similar or dissimilar, and can be used in various fields such as computer vision, machine learning, and signal processing.

3. Can the angle between matrices be negative?

No, the angle between matrices cannot be negative. The range of angles between two matrices is typically between 0 and π radians, or 0 and 180 degrees.

4. Is there a specific method for calculating angles between non-square matrices?

Yes, there are various methods for calculating angles between non-square matrices. One approach is to take the singular value decomposition (SVD) of the matrices and use the angles between the resulting singular values. Another method is to extend the matrices to square matrices by adding zeros and then calculating the angles using the standard methods.

5. Can the angle between matrices be used to determine if two matrices are orthogonal?

Yes, the angle between two matrices can be used to determine if they are orthogonal. If the angle between two matrices is 90 degrees, then they are orthogonal. However, it is important to note that two matrices can have a 90 degree angle between them and still not be orthogonal.

Similar threads

Replies
7
Views
1K
  • Linear and Abstract Algebra
Replies
16
Views
1K
  • Linear and Abstract Algebra
Replies
14
Views
2K
Replies
7
Views
2K
  • Linear and Abstract Algebra
Replies
3
Views
2K
Replies
13
Views
2K
  • Linear and Abstract Algebra
Replies
1
Views
1K
  • Linear and Abstract Algebra
Replies
19
Views
2K
  • Linear and Abstract Algebra
Replies
13
Views
2K
Replies
31
Views
2K
Back
Top