Transformation of Coordinates

# Translation of Coordinate Axes

[edit | edit source]

Graph in 2 dimensions illustrating Translation of Coordinate Axes.
Points  P , P ′ {\displaystyle P,P'} are same point.
Point  P {\displaystyle P} is defined relative to origin  O , {\displaystyle O,} black arrows.
Point  P ′ {\displaystyle P'} is defined relative to origin  Ω , {\displaystyle \Omega ,} red arrows.

Any point in the 2 dimensional Cartesian plane is usually defined as  ( x , y ) {\displaystyle (x,y)} meaning that the point is  x {\displaystyle x} units horizontally from origin  O = ( 0 , 0 ) {\displaystyle O=(0,0)} and  y {\displaystyle y} units vertically from origin.

It is always possible, and sometimes desirable, to give the point a new name or definition that reflects its position relative to another point in the 2 dimensional plane, for example  Ω , {\displaystyle \Omega ,} the position of which is defined as  ( h , k ) {\displaystyle (h,k)} relative to origin  O . {\displaystyle O.}

In the diagram point  P {\displaystyle P} and point  P ′ {\displaystyle P'} are the same point. It's just that the point has the name or definition  P {\displaystyle P} when referenced to origin  O {\displaystyle O} (black arrows), and  P ′ {\displaystyle P'} when referenced to origin  Ω {\displaystyle \Omega } (red arrows).

By inspection:

* h + x ′ = x {\displaystyle h+x'=x} or  x ′ = x − h {\displaystyle x'=x-h}

* k + y ′ = y {\displaystyle k+y'=y} or  y ′ = y − k . {\displaystyle y'=y-k.}

Actual values:

Ω = ( h , k ) = ( 6 , 4 ) {\displaystyle \Omega =(h,k)=(6,4)}

P = ( x , y ) = ( 9 , 10.5 ) {\displaystyle P=(x,y)=(9,10.5)}

P ′ = ( x ′ , y ′ ) {\displaystyle P'=(x',y')} = ( x − h , y − k ) {\displaystyle =(x-h,y-k)} = ( 9 − 6 , 10.5 − 4 ) {\displaystyle =(9-6,10.5-4)} = ( 3 , 6.5 ) . {\displaystyle =(3,6.5).}

Point  P {\displaystyle P} is defined as  ( 9 , 10.5 ) {\displaystyle (9,10.5)} relative to origin  O , {\displaystyle O,} and point  P ′ , {\displaystyle P',} the same point, is defined as  ( 3 , 6.5 ) {\displaystyle (3,6.5)} relative to origin  Ω . {\displaystyle \Omega .}

## Examples

[edit | edit source]

### Linear function

[edit | edit source]

|  Graph in 2 dimensions illustrating Translation of Coordinate Axes applied to linear function.
`line1` can have 2 equations:
*  2 x + 3 y − 18 = 0 {\displaystyle 2x+3y-18=0} relative to origin  O . {\displaystyle O.}
*  2 x ′ + 3 y ′ + 6 = 0 {\displaystyle 2x'+3y'+6=0} relative to origin  Ω . {\displaystyle \Omega .}

In the diagram `line1` has equation  2 x + 3 y − 18 = 0. {\displaystyle 2x+3y-18=0.}

What is equation of `line1` relative to origin  Ω = ( 6 , 4 ) ? {\displaystyle \Omega =(6,4)?}

Using  x = x ′ + h ,   y = y ′ + k : {\displaystyle x=x'+h,\ y=y'+k:}

2 ( x ′ + 6 ) + 3 ( y ′ + 4 ) − 18 = 0 {\displaystyle 2(x'+6)+3(y'+4)-18=0}

2 x ′ + 12 + 3 y ′ + 12 − 18 = 0 {\displaystyle 2x'+12+3y'+12-18=0}

2 x ′ + 3 y ′ + 6 = 0 {\displaystyle 2x'+3y'+6=0}

When  x , y {\displaystyle x,y} become  x ′ , y ′ , {\displaystyle x',y',} this means that equation  2 x ′ + 3 y ′ + 6 = 0 {\displaystyle 2x'+3y'+6=0} is relative to origin  Ω . {\displaystyle \Omega .} `line1` can have equation  2 x + 3 y − 18 = 0 {\displaystyle 2x+3y-18=0} or equation  2 x ′ + 3 y ′ + 6 = 0. {\displaystyle 2x'+3y'+6=0.}

Equation  2 x ′ + 3 y ′ + 6 = 0 {\displaystyle 2x'+3y'+6=0} relative to origin  Ω {\displaystyle \Omega } is same as equation  2 x + 3 y + 6 = 0 {\displaystyle 2x+3y+6=0} relative to origin  O . {\displaystyle O.}

Note that in both cases:

* X {\displaystyle X} intercept relative to origin is  − 3. {\displaystyle -3.}

* Y {\displaystyle Y} intercept relative to origin is  − 2. {\displaystyle -2.}

# Rotation of Coordinate Axes

[edit | edit source]

Graph in 2 dimensions illustrating Rotation of Coordinate Axes.
Point  P {\displaystyle P} has 2 names or definitions:
( x , y ) = ( 15 , 30 ) {\displaystyle (x,y)=(15,30)} when defined relative to black arrows.
( x ′ , y ′ ) = ( 30 , 15 ) {\displaystyle (x',y')=(30,15)} when defined relative to red arrows.

If  X {\displaystyle X} axis, line  O X {\displaystyle OX} , is rotated through angle  θ {\displaystyle \theta } so that  X {\displaystyle X} axis of new system becomes  O X ′ {\displaystyle OX'} then:

* Counter-clockwise rotation occurs when  θ {\displaystyle \theta } is positive.

* Y {\displaystyle Y} axis of new system becomes  O Y ′ . {\displaystyle OY'.}

* angle between  O X {\displaystyle OX} and  O X ′ {\displaystyle OX'} is  θ . {\displaystyle \theta .}

* angle between  O Y {\displaystyle OY} and  O Y ′ {\displaystyle OY'} is  θ . {\displaystyle \theta .}

See diagram. By inspection:

Angle  T P Q = θ {\displaystyle TPQ=\theta }

Q R = S T = x ′ sin ⁡ θ {\displaystyle QR=ST=x'\sin \theta }

Q T = R S = y ′ sin ⁡ θ {\displaystyle QT=RS=y'\sin \theta }

P Q = y ′ cos ⁡ θ {\displaystyle PQ=y'\cos \theta }

O S = x ′ cos ⁡ θ = O R + R S = x + y ′ sin ⁡ θ   …   ( 1 ) {\displaystyle OS=x'\cos \theta =OR+RS=x+y'\sin \theta \ \dots \ (1)}

P R = y = P Q + Q R = y ′ cos ⁡ θ + x ′ sin ⁡ θ   …   ( 2 ) {\displaystyle PR=y=PQ+QR=y'\cos \theta +x'\sin \theta \ \dots \ (2)}

From  ( 1 ) ,   x = x ′ cos ⁡ θ − y ′ sin ⁡ θ   …   ( 3 ) {\displaystyle (1),\ x=x'\cos \theta -y'\sin \theta \ \dots \ (3)}

From  ( 2 ) ,   y = x ′ sin ⁡ θ + y ′ cos ⁡ θ   …   ( 4 ) {\displaystyle (2),\ y=x'\sin \theta +y'\cos \theta \ \dots \ (4)}

From  ( 3 ) {\displaystyle (3)} and  ( 4 ) : {\displaystyle (4):}

x ′ = x cos ⁡ θ + y sin ⁡ θ   …   ( 5 ) {\displaystyle x'=x\cos \theta +y\sin \theta \ \dots \ (5)}

y ′ = y cos ⁡ θ − x sin ⁡ θ   …   ( 6 ) {\displaystyle y'=y\cos \theta -x\sin \theta \ \dots \ (6)}

Actual values:

Converting from  ( x , y ) {\displaystyle (x,y)} to  ( x ′ , y ′ ) {\displaystyle (x',y')}

# Python code.
>>> c,s = cosθ,sinθ = 4/5,3/5 ; c,s
(0.8, 0.6)
>>> x,y = 15,30
>>> x1 = x*c + y*s
>>> y1 = y*c - x*s
>>> x1,y1
(30.0, 15.0)

Process reversed:

# Python code.
>>> c,s = cosθ,sinθ = 4/5,-3/5 ; c,s
(0.8, -0.6)
>>> x,y = 30,15
>>> x1 = x*c + y*s
>>> y1 = y*c - x*s
>>> x1,y1
(15.0, 30.0)

## Examples

[edit | edit source]

### Linear function

[edit | edit source]

|  Graph in 2 dimensions illustrating Rotation of Coordinate Axes applied to linear function.
`line1` has 2 equations:
*  6 x + 17 y = 300 {\displaystyle 6x+17y=300} relative to  O X , O Y {\displaystyle OX,OY} (black system).
*  3 x ′ + 2 y ′ = 60 {\displaystyle 3x'+2y'=60} relative to  O X ′ , O Y ′ {\displaystyle OX',OY'} (red system).

Let a line have equation:  a x + b y + d = 0. {\displaystyle ax+by+d=0.}

Let  c = cos ⁡ θ ;   s = sin ⁡ θ . {\displaystyle c=\cos \theta ;\ s=\sin \theta .}

After rotation, equation of line relative to  O X ′ , O Y ′ {\displaystyle OX',OY'} (red arrows) is:

a ( x ′ c − y ′ s ) + b ( x ′ s + y ′ c ) + d {\displaystyle a(x'c-y's)+b(x's+y'c)+d} = a x ′ c − a y ′ s + b x ′ s + b y ′ c + d {\displaystyle =ax'c-ay's+bx's+by'c+d} = a x ′ c + b x ′ s + b y ′ c − a y ′ s + d {\displaystyle =ax'c+bx's+by'c-ay's+d} = x ′ a c + x ′ b s + y ′ b c − y ′ a s + d {\displaystyle =x'ac+x'bs+y'bc-y'as+d} = x ′ ( a c + b s ) + y ′ ( b c − a s ) + d {\displaystyle =x'(ac+bs)+y'(bc-as)+d} = A x ′ + B y ′ + d = 0   …   ( 1 ) {\displaystyle =Ax'+By'+d=0\ \dots \ (1)}

where:  A = a cos ⁡ θ + b sin ⁡ θ ; {\displaystyle A=a\cos \theta +b\sin \theta ;}   B = b cos ⁡ θ − a sin ⁡ θ . {\displaystyle \ B=b\cos \theta -a\sin \theta .}

In the diagram `line1` has equation  6 x + 17 y − 300 = 0 , {\displaystyle 6x+17y-300=0,} and  cos ⁡ θ = 4 5 . {\displaystyle \cos \theta ={\frac {4}{5}}.}

What is equation of `line1` relative to  O X ′ , O Y ′ {\displaystyle OX',OY'} (red system)?

# python code.
>>> a,b,d = 6,17,-300
>>> c,s = cosθ,sinθ = 4/5,3/5 ; c,s
(0.8, 0.6)
>>> A = a*c + b*s ; A
15.0
>>> B = b*c - a*s ; B
10.0

Equation of `line1` relative to  O X ′ , O Y ′ :   15 x ′ + 10 y ′ − 300 = 0 {\displaystyle OX',OY':\ 15x'+10y'-300=0} or  3 x ′ + 2 y ′ = 60. {\displaystyle 3x'+2y'=60.}

O P = O P ′ ;   O Q = O Q ′ . {\displaystyle OP=OP';\ OQ=OQ'.} Triangles  O P Q , O P ′ Q ′ {\displaystyle OPQ,OP'Q'} are congruent.

Line1:  3 x ′ + 2 y ′ = 60 {\displaystyle 3x'+2y'=60} has same position in red system as line2:  3 x + 2 y = 60 {\displaystyle 3x+2y=60} in black system.

### Quartic function

[edit | edit source]

Graph in 2 dimensions illustrating Rotation of Coordinate Axes applied to quartic function.
Position of black curve in red system is same as that of red curve in black system.

Let quartic function be defined as  y = f ( x ) = 1.5625 x 4 − 12.125 x 3 − 14.75 x 2 + 136.5 x + 114 48 . {\displaystyle y=f(x)={\frac {1.5625x^{4}-12.125x^{3}-14.75x^{2}+136.5x+114}{48}}.}

In diagram,  X {\displaystyle X} and  Y {\displaystyle Y} axes are rotated through angle  θ {\displaystyle \theta } to produce new system of coordinates  O X ′ , O Y ′ {\displaystyle OX',OY'} (red system.)

cos ⁡ θ = 4 5 . {\displaystyle \cos \theta ={\frac {4}{5}}.} What is equation of  f ( x ) {\displaystyle f(x)} relative to red system?

g ( x , y ) = a x 4 + b x 3 + c x 2 + d x + e − y {\displaystyle g(x,y)=ax^{4}+bx^{3}+cx^{2}+dx+e-y}

After substituting appropriate values for  a , b , c , d , e , x , y {\displaystyle a,b,c,d,e,x,y} code supplied to application grapher is:

(0.0325520833333333)  ((x(0.8) - y(0.6))^4)
+ (-0.252604166666667)  ((x(0.8) - y(0.6))^3)
+ (-0.307291666666667)  ((x(0.8) - y(0.6))^2)
+            (2.84375)  ((x(0.8) - y(0.6))  )
+ (2.375)
- (x(0.6) + y(0.8)) = 0

Red curve in diagram has equation  g ( x , y ) = 0. {\displaystyle g(x,y)=0.}

### Ellipse

[edit | edit source]

Graph in 2 dimensions illustrating Rotation of Coordinate Axes applied to ellipse.

Equation of ellipse in diagram is:  f ( x , y ) = 55 x 2 − 24 x y + 48 y 2 − 2496 = 0. {\displaystyle f(x,y)=55x^{2}-24xy+48y^{2}-2496=0.}

What is equation of  f ( x , y ) {\displaystyle f(x,y)} relative to minor and major axes (red system)?

The most general equation of second degree in  x , y {\displaystyle x,y} has form:  a x 2 + b x y + c y 2 + d x + e y + f = 0. {\displaystyle ax^{2}+bxy+cy^{2}+dx+ey+f=0.}

Rotation of coordinate axes when applied to the general equation produces the primed equation:  A ( x ′ ) 2 + B x ′ y ′ + C ( y ′ ) 2 + D x ′ + E y ′ + F = 0 {\displaystyle A(x')^{2}+Bx'y'+C(y')^{2}+Dx'+Ey'+F=0} where:

A = a n 2 + b n s + c s 2 {\displaystyle A=an^{2}+bns+cs^{2}}

B = b n 2 − 2 a n s + 2 c n s − b s 2 {\displaystyle B=bn^{2}-2ans+2cns-bs^{2}} = b n 2 + ( 2 c − 2 a ) n s − b s 2 {\displaystyle =bn^{2}+(2c-2a)ns-bs^{2}}

C = c n 2 − b n s + a s 2 {\displaystyle C=cn^{2}-bns+as^{2}}

D = d n + e s {\displaystyle D=dn+es}

E = e n − d s {\displaystyle E=en-ds}

F = f {\displaystyle F=f}

n = cos ⁡ θ {\displaystyle n=\cos \theta }

s = sin ⁡ θ {\displaystyle s=\sin \theta }

Choose values of  sin ⁡ θ , cos ⁡ θ {\displaystyle \sin \theta ,\cos \theta } that make coefficient  B = 0. {\displaystyle B=0.}

From coefficient  B {\displaystyle B} above:

b n 2 + ( 2 c − 2 a ) n s − b s 2 = 0 {\displaystyle bn^{2}+(2c-2a)ns-bs^{2}=0}

b n 2 − b s 2 = − ( 2 c − 2 a ) n s {\displaystyle bn^{2}-bs^{2}=-(2c-2a)ns}

Square both sides, substitute  ( 1 − s s ) {\displaystyle (1-ss)} for  n n , {\displaystyle nn,} expand, gather like terms and result is:

P S 2 + Q S + R = 0   …   ( 1 ) {\displaystyle PS^{2}+QS+R=0\ \dots \ (1)} where:

S = sin 2 ⁡ θ {\displaystyle S=\sin ^{2}\theta }

P = 4 a 2 + 4 b 2 + 4 c 2 − 8 a c {\displaystyle P=4a^{2}+4b^{2}+4c^{2}-8ac}

Q = − P {\displaystyle Q=-P}

R = b 2 {\displaystyle R=b^{2}}

See also:  Solving ellipse at origin.

From  ( 1 ) {\displaystyle (1)} above,  S = 0.36 {\displaystyle S=0.36} or  0.64. {\displaystyle 0.64.}

sin ⁡ θ = S = ± 0.6 {\displaystyle \sin \theta ={\sqrt {S}}=\pm 0.6} or  ± 0.8. {\displaystyle \pm 0.8.}

|  Graph in 2 dimensions showing 2 ellipses, f'(x,y), where f'(x,y) is f(x,y) relative to its minor and major axes.

# python code.
values_of_cosθ_sinθ = (
(0.6,-0.8),
(0.6,0.8),
(0.8,-0.6),
(0.8,0.6),

a,b,c,d,e,f = 55,-24,48,0,0,-2496

for ns in values_of_cosθ_sinθ :
n,s = ns
B = b*n*n + (2*c-2*a)*n*s - b*s*s
if (abs(B) < 1e-14) :
print ('ns =',n,s)
A = a*n*n + b*n*s + c*s*s
C = c*n*n - b*n*s + a*s*s
D = d*n + e*s
E = e*n - d*s
F = f
print ('   ',A,0,C,D,E,F)

ns = 0.6 0.8
39.0 0 64.0 0.0 0.0 -2496
ns = 0.8 -0.6
64.0 0 39.0 0.0 0.0 -2496

When  cos ⁡ θ , sin ⁡ θ = 0.6 , 0.8 ,   f ′ ( x , y ) = 39 x 2 + 64 y 2 − 2496 = 0. {\displaystyle \cos \theta ,\sin \theta =0.6,0.8,\ f'(x,y)=39x^{2}+64y^{2}-2496=0.}

When  cos ⁡ θ , sin ⁡ θ = 0.8 , − 0.6 ,   f ′ ( x , y ) = 64 x 2 + 39 y 2 − 2496 = 0. {\displaystyle \cos \theta ,\sin \theta =0.8,-0.6,\ f'(x,y)=64x^{2}+39y^{2}-2496=0.}

In this context,  f ′ ( x , y ) {\displaystyle f'(x,y)} is not the derivative of  f ( x , y ) . {\displaystyle f(x,y).}

Expression  f ′ ( x , y ) {\displaystyle f'(x,y)} means  f ( x , y ) {\displaystyle f(x,y)} relative to primed system  O X ′ , O Y ′ {\displaystyle OX',OY'} (red system.)