Ok, let's break down transformations in mathematics. Transformations alter the position, size, or orientation of a shape or object. There are four primary types:
1. Translation ➡️
A translation involves moving a shape from one location to another without changing its size, shape, or orientation. It's essentially a 'slide'.
- Concept: Shifting every point of a shape by the same distance in the same direction.
- Example: Imagine sliding a chess piece across the board.
- Mathematical Representation: If you have a point $(x, y)$, a translation by $(a, b)$ moves the point to $(x+a, y+b)$.
- Code Example:
def translate(x, y, a, b):
new_x = x + a
new_y = y + b
return new_x, new_y
# Example usage:
x, y = 1, 2
a, b = 3, 4
new_x, new_y = translate(x, y, a, b)
print(f"Original point: ({x}, {y})")
print(f"Translated point: ({new_x}, {new_y})")
2. Reflection зеркало
A reflection creates a mirror image of a shape over a line, called the line of reflection.
- Concept: Flipping a shape over a line.
- Example: Looking at your reflection in a mirror.
- Mathematical Representation: Reflecting over the x-axis changes $(x, y)$ to $(x, -y)$. Reflecting over the y-axis changes $(x, y)$ to $(-x, y)$.
- Code Example:
def reflect_x(x, y):
return x, -y
def reflect_y(x, y):
return -x, y
# Example usage:
x, y = 1, 2
new_x_x, new_y_x = reflect_x(x, y)
new_x_y, new_y_y = reflect_y(x, y)
print(f"Original point: ({x}, {y})")
print(f"Reflected over x-axis: ({new_x_x}, {new_y_x})")
print(f"Reflected over y-axis: ({new_x_y}, {new_y_y})")
3. Rotation 🔄
A rotation involves turning a shape around a fixed point, called the center of rotation.
- Concept: Turning a shape around a point.
- Example: The hands of a clock rotating around the center.
- Mathematical Representation: Rotating a point $(x, y)$ by $\theta$ degrees counterclockwise around the origin results in a new point $(x', y')$ where:
$x' = x \cos(\theta) - y \sin(\theta)$
$y' = x \sin(\theta) + y \cos(\theta)$
- Code Example:
import math
def rotate(x, y, angle):
angle_rad = math.radians(angle)
new_x = x * math.cos(angle_rad) - y * math.sin(angle_rad)
new_y = x * math.sin(angle_rad) + y * math.cos(angle_rad)
return new_x, new_y
# Example usage:
x, y = 1, 0
angle = 90 # Rotate 90 degrees
new_x, new_y = rotate(x, y, angle)
print(f"Original point: ({x}, {y})")
print(f"Rotated point: ({new_x:.2f}, {new_y:.2f})")
4. Dilation 📐
A dilation changes the size of a shape. It can either enlarge (expansion) or shrink (contraction) the shape.
- Concept: Resizing a shape.
- Example: Zooming in or out on a map.
- Mathematical Representation: If you have a point $(x, y)$ and a scale factor $k$, the dilated point is $(kx, ky)$. If $k > 1$, it's an enlargement; if $0 < k < 1$, it's a reduction.
- Code Example:
def dilate(x, y, k):
new_x = k * x
new_y = k * y
return new_x, new_y
# Example usage:
x, y = 1, 2
k = 2 # Scale factor of 2 (enlargement)
new_x, new_y = dilate(x, y, k)
print(f"Original point: ({x}, {y})")
print(f"Dilated point: ({new_x}, {new_y})")