Finding a Linear Transform for Contraction of Vectors

  • Context: Undergrad 
  • Thread starter Thread starter MikeLizzi
  • Start date Start date
  • Tags Tags
    Contraction Transform
Click For Summary

Discussion Overview

The discussion revolves around finding a linear transformation that scales a vector in the direction of another specified vector. The context includes theoretical exploration and practical application, particularly for use in computer programming to contract shapes by varying amounts and directions.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant seeks a linear transformation that scales vectors in a specified direction, providing an example with specific vectors.
  • Another participant suggests forming a transformation matrix and sets up equations based on the desired transformations of the given vectors.
  • A different participant proposes a method involving rotation and scaling to achieve the desired transformation for any vector, detailing the steps involved in the process.
  • Some participants discuss the properties of the transformation matrix, including the need for it to maintain orthogonality for vectors orthogonal to the scaling direction.
  • There is a query about the form of the orthogonal matrix needed to align the direction vector with the x-axis, indicating challenges in extending the method to three dimensions.
  • A later reply indicates a resolution of the participant's issues, attributing the problem to programming syntax rather than the mathematical approach.

Areas of Agreement / Disagreement

Participants express various approaches and methods to achieve the transformation, with no consensus on a single solution or method. The discussion includes both agreement on the need for specific properties of the transformation matrix and differing strategies for implementation.

Contextual Notes

Some assumptions about the properties of the transformation matrix and the nature of the vectors involved are not fully resolved. The discussion also reflects a dependency on programming language syntax, which may affect the implementation of the proposed mathematical strategies.

MikeLizzi
Messages
239
Reaction score
6
Hi folks,

This is my first post here. I hope this is the right forum for this question.

I am trying to come up with a linear transform to that will take as input a vector (x, y, z) and output a vector that is scaled in the direction of another vector.

For example:
Suppose I have the corners of a square defined by the four vectors
(4, 4, 0)
(-4, 4, 0)
(-4, -4, 0)
(4, -4, 0)

I want to scale those vectors by 50% in the direction specified by the vector < 1, 1, 0 >

I want to end up with the four vectors
(2, 2, 0)
(-4, 4, 0)
(-2, -2, 0)
(4, -4, 0)

The initial square has been “squashed” by 50% in the northeast/southwest direction.
Can anybody come up with a transform for that?
 
Physics news on Phys.org
So you want a matrix of the form
[tex]\begin{pmatrix}a & b & c \\ d & e & f \\ g & h & i\end{pmatrix}[/tex]
such that
[tex]\begin{pmatrix}a & b & c \\ d & e & f \\ g & h & i\end{pmatrix}\begin{pmatrix}4 \\ 4 \\ 0\end{pmatrix}= \begin{pmatrix}2 \\ 2 \\ 0\end{pmatrix}[/tex]
That gives the three equations 4a+ 4b= 2, 4d+ 4e= 2, and 4g+ 4h= 0.

You also want
[tex]\begin{pmatrix}a & b & c \\ d & e & f \\ g & h & i\end{pmatrix}\begin{pmatrix}-4 \\ 4 \\ 0\end{pmatrix}= \begin{pmatrix}-4 \\ 4 \\ 0\end{pmatrix}[/tex]
That gives the three equations -4a+ 4b= -4, -4d+ 4e= 4, -4g+ 4h= 0.

Doing the same with the other two points will give you a total of twelve equations for the 9 values, a, b, c, d, e, f, g, h, and i. But I think you will find the last three redundant. Once you have the first three points, the requirement that the figure be a parallelogram fixes the fourth.
 
Last edited by a moderator:
Thank you HallsofIvy.

But I’m looking for a formula that will convert any vector. I will be using this formula in a computer program that will contract any shape by any amount in any direction.
This is my current strategy:

For any given point (x, y, z), direction vector (vx, vy, vz) and scale g;
Rotate the point so that its x-axis lines up with the direction vector.
That means two separate rotations for a point in 3d.
Then multiply the x value by the scale.
Then back out the two rotations in reverse order.

I built the following:
Matrix A rotates the point about the Z-axis
Matrix B rotates the point about the X-axis
Matrix C scales only the x dimension.
Matrix D is the inverse of B
Matrix E is the inverse of A

So if P (x, y, z) is the input and P’ (x’, y’, z’) is the output I have
P’ = [E][D][C][A]P
Unfortunately, the strategy is not working.
 
So you want a matrix T that scales by a factor of g along the vector v, while leaving everything orthogonal to v fixed. That is, Tv = gv, and Tu = u for all u orthogonal to v. You now have the eigenvalues and eigenspaces of T. Since the eigenspaces are orthogonal, to find T all you need is an orthogonal matrix Q such that Qv is on the first coordinate (x) axis; then you'll have T = QTDQ, where D = diag(g, 1, ..., 1) is the diagonal matrix of eigenvalues.

Observe that since your eigenvalues are real and eigenspaces are orthogonal, T will be a symmetric matrix.
 
adriank said:
So you want a matrix T that scales by a factor of g along the vector v, while leaving everything orthogonal to v fixed. That is, Tv = gv, and Tu = u for all u orthogonal to v. You now have the eigenvalues and eigenspaces of T. Since the eigenspaces are orthogonal, to find T all you need is an orthogonal matrix Q such that Qv is on the first coordinate (x) axis; then you'll have T = QTDQ, where D = diag(g, 1, ..., 1) is the diagonal matrix of eigenvalues.

Observe that since your eigenvalues are real and eigenspaces are orthogonal, T will be a symmetric matrix.

This sounds great, adriank, but what does Q look like? I'm thinking it has to be a transform that rotates v into the x-axis. And the inverse of Q would rotate it back. I got something that works when u and v are two dimensional vectors.

But my three dimensional attempt fails.
 
I think I got it!

My problem was more to do with the syntax of the programming language.

Thank you all.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K