# Using matrices for functions -- transformations and translation

1. Jan 1, 2017

### Taylor_1989

1. The problem statement, all variables and given/known data
Happy new year all. I was wondering if you can use matrices to translate and transform a function? So for example if I were to take the function $$f(x)=x^2+4x$$ and I want to the translate and transform the equation to $$2f(x+4)$$. Can this be done by matrices.

I know how to use matrices to solve simultaneous equations ect. which is what got me thinking down this route. Could someone point me in the right direction, or link some website that might help me.

2. Relevant equations
N/A

3. The attempt at a solution
N/A

2. Jan 1, 2017

### PeroK

Your question makes no sense to me.

3. Jan 1, 2017

### Logical Dog

edit: he want to use matrices ON A FUNCTION, to convert it to the second equation he posted.

Last edited: Jan 1, 2017
4. Jan 1, 2017

### PeroK

That question makes no sense to me either!

5. Jan 1, 2017

### Logical Dog

he wants to

1. use matrices or matrix operations or anything related to matrices, ON a function in order to
2. Make the end result be the second equation he posted in op

is this possible? sorry for confusion. I am also lost, I have studied matrixes but never heard of it any of it being applied on aof quadratic function.

@PeroK

Last edited: Jan 1, 2017
6. Jan 1, 2017

### Taylor_1989

Sorry for the confusion. It was just a thought. I just used a quadratic as an example. So a aother would be this:

$$f(x)=x^2$$

$$f(x)+3=x^2+3$$

So if I where to draw it, I would start with the x^2 and move it 3units to the left in the negative x-direction. I was just wondering if you can use matrices to do the same thing.

7. Jan 1, 2017

### Staff: Mentor

No, that isn't right. To get the graph of y = f(x) + 3, translate the graph of y = f(x) upward by 3 units.
To get the graph of y = f(x + 3), translate the graph of y = f(x) left by 3 units. Maybe that's what you were thinking.
I don't think so. A matrix operates on vectors, not functions.

8. Jan 1, 2017

### Buffu

It would move on +ve y-axis by not on -ve x-axis.

if we represent your function as a vector $\vec{a} (x) =\begin{bmatrix}x \\ x^2 \\1\end{bmatrix}$
Then I think we will use
$$A = \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 &3 \\ 0&0 & 1 \end{bmatrix}$$
To translate the points.
Then new points we will be
$$\vec a^{\prime}(x)= A \times \vec a = \begin{bmatrix} x \\ x^2 + 3 \\ 1 \end{bmatrix}$$

Last edited: Jan 1, 2017
9. Jan 1, 2017

### Taylor_1989

Sorry I miss the bracket.

10. Jan 1, 2017

### Taylor_1989

@Buffu That what I am trying now. But I think I am confusing myself with applying the translation part. I will post my working in a bit. The part I am getting stuck with is applying the translations in the vector form.

11. Jan 1, 2017

### Buffu

check my edit.
Are you doing this for a computer graphics project ?
I think you are probably confusing between column-wise and row-wise matrix.

12. Jan 1, 2017

### Taylor_1989

No, no project it was just a thought I had. I just was wondering if its possible. Ah, I have just seen your post, that did not appear on my phone before. I see where you coming from.

13. Jan 1, 2017

### Ray Vickson

This cannot really be done well using matrices, but it can be done using operators (which are like $\infty \times \infty$ matrices!) So, we can write
$$2 f(x+4) = 2 e^{4D} f(x),$$
where
$$D = \frac{d}{dx}$$
is the "differentiation" operator.

The exponential of $D$ is defined as an infinite series: for constant $a$,
$$e^{aD} = 1 + aD + \frac{a^2}{2!} D^2 + \frac{a^3}{3!} D^3 + \cdots .$$
However, when applied to a quadratic function $f(x)$ we have $D^3 f = D^4 f = \cdots = 0$, so we get a finite expression
$$2 f(x+3) = 2 \left( f(x) + 4 Df(x) + \frac{4^2}{2!} D^2 f(x) \right) .$$

14. Jan 1, 2017

### Stephen Tashi

Yes you can. The simplest way to think about it is that we express the same graph in a new coordinate system.

The transformation $\begin{pmatrix} x_b \\ y_b \end{pmatrix} = \begin{pmatrix} a_{1,1}&a_{1,2}\\ a_{2,1}&a_{2,2}\end{pmatrix} \begin{pmatrix} x_a \\ y_a \end{pmatrix}$ where that $a_{i,j}$ are constants defines a "linear transformation" from the $(x_a,x_b)$ coordinate system to the $(x_b,y_b)$ coordinate system.

We can do a transformation involving the translation of coordinates by using "projective coordinates". In projective coordinates we represent the point $(x,y)$ in 2D as $\begin{pmatrix} x\\y\\1\end{pmatrix}$.
A transformation in projective coordinates is

$\begin{pmatrix} x_b \\ y_b \\1 \end{pmatrix} = \begin{pmatrix} a_{1,1}&a_{1,2}&a_{1,3}\\ a_{2,1}&a_{2,2}&a_{2,3} \\0&0&1\end{pmatrix} \begin{pmatrix} x_a \\ y_a \\ 1\end{pmatrix}$

Suppose we wish the new coordinate system to have its origin $(x_b = 0, y_b= 0)$ at ($x_a = 4, y_a = 0)$ and we want the scale on the $y_b$ axis to be half that of the $y_a$ axis, so that $y_a = 1$ and $y_b = 2$ represent the same distance. A transformation that accomplishes that is:

$\begin{pmatrix} x_b \\ y_b \\1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & -4\\ 0 & 2& 0 \\0&0&1\end{pmatrix} \begin{pmatrix} x_a \\ y_a \\ 1\end{pmatrix}$

So:
$x_b = x_a - 4$ thus $x_a = x_b + 4$
$y_b = 2 y_a$ thus $y_a = (1/2) y_b$

The graph of $y_a = f_a(x_a) = x_a^2 + 4 x_a$ is transformed to the new coordinates by substituting $x_a = x_b + 4, y_a = (1/2)y_b$ which gives:

$(1/2)y_b = (x_b + 4)^2 + 4(x_b + 4)$
$y_b = f_b(x_b) = 2 ( ( x_b^2 +8 x_b + 16) + 4x_b + 16) = 2x_b^2 + 24 x_b + 64$

There is a close relationship between "changing coordinates and keeping the same graph" and "changing the graph and keeping the same coordinate system". Suppose we pretend the function we have written in $(x_b,y_b)$ coordinates is actually a function expressed in the original $(x_a,y_a)$ coordinates. Then we have tranformed the function $y_a = f_a(x_a)= x_a^2 + 4 x_a$ to a new function $y_a = g_a(x_a) = 2 x_a^2 + 24 x_a + 64$ and kept the coordinate system the same.

This close relationship is useful, but it usually causes me some confusion because linear transformations back and forth between two coordinate systems involve a matrix $A$ and its inverse $A^{-1}$ and in a given problem its easy to forget which "direction" of transforming coordinates corresponds to which of $A$ and $A^{-1}$ and there is also the problem of whether we are keeping the same graph and transforming the coordinates to new coordinates or whether we are keeping the same coordinates and transforming the graph to a new graph.

A line perpendicular to the x axis of an cartesian (x,y) coordinate system must not intersect he graph of a function in more than one point. A transformation that rotates the coordinate systems (or rotates the graph in the same coordinates) may transform the graph of a function to a graph that is not the graph of a function. You can look up the topic of "rotation matrices" to find examples of transformations that rotate coordinates.