This post is also available in: हिन्दी (Hindi) العربية (Arabic)

Knowledge of graphs helps a lot in computer graphics. The graphs are a visual representation of functions. Many times when you know what the graph of a particular function looks like, and you want to know what the graph of a very similar function looks like. For example, if you know the graph of f(x) = x^{2}, and want to know the graph of functions – f(x) = x^{2} + 3 or f(x) x^{2} – 5 or f(x) = (x + 1)^{2} or f(x) = (x – 2)^{2}, etc. In the following text, we will look into 3 Basic Graph Transformations for awesome graphics.

The graphs of all these functions have the same shape and they differ with respect to their position in the Cartesian plane.

It means that you can plot a number of graphs quickly and easily if you know the shape of basic functions.

## Graphs of Basic Functions

Following are some of the basic functions and their graphs. If you know the shape of graphs of these basic functions, you can easily plot the graphs of other related and similar functions.

By applying transformations to these basic graphs, you are able to obtain new graphs that still have all the properties of the old ones. By understanding the basic graphs and the way transformations apply to them, you will recognize each new graph as a small variation in an old one, not as a completely different graph that you have never seen before. Understanding these transformations will allow you to quickly recognize and sketch a new function without having to resort to plotting points.

## 3 Basic Graph Transformations

There are three types of transformations through which the graphs go through when a function is changed. These transformations are:

- Translation
- Reflection
- Stretching

**Translation**: Translation is a process of shifting the graph of a function either left, right, up, or down. To understand how it works, let’s consider an example of basic quadratic function – f(x) = x^{2}. The graph of f(x) = x^{2} is

**Translating the graph towards up:** Function f(x) + a translates the graph of a function f(x) upwards by ‘a’ units. For example, f(x) = x^{2} + 3 will shift the graph of f(x) = x^{2} , 3 units upwards.

**Translating the graph towards down:** Function f(x) – a translates the graph of a function f(x) downwards by ‘a’ units. For example, f(x) = x^{2} – 5 will shift the graph of f(x) = x^{2} , 5 units downwards.

**Translating the graph towards left:** Function f(x + a) translates the graph of a function f(x) leftwards by ‘a’ units. For example, f(x) = (x + 1)^{2} will shift the graph of f(x) = x^{2} , 1 units leftwards.

**Translating the graph towards right:** Function f(x – a) translates the graph of a function f(x) rightwards by ‘a’ units. For example, f(x) = (x – 2)^{2} will shift the graph of f(x) = x^{2} , 2 units rightwards.

## Reflection

Reflection of a graph is a process of flipping the graph about one of the coordinate axes – x-axis or y-axis. To understand this, let’s consider the base function f(x) = e^{x}.

The first, flipping upside down (reflection about x-axis), is found by taking the negative of the original function, that is the function -f(x) flips the graph of f(x) about x-axis. For example, f(x) = -e^{x} will flip the graph of f(x) = e^{x} about x-axis.

The second, is flipping laterally (reflection about y-axis), is found by taking the changing x to -x, that is the function f(-x) flips the graph of f(x) about y-axis. For example, f(x) = e^{-x} will flip the graph of f(x) = e^{x} about y-axis.

## Stretching

The stretching of a graph is of two types – vertical and horizontal. To understand this concept, let’s again consider the function f(x) = x^{2}.

A **vertical stretching** is the stretching of the graph away from the x-axis. And a vertical compression (or shrinking) is the squeezing of the graph towards the x-axis. A function k.f(x) stretches the graph of the function f(x) vertically.

- If k > 1, the graph of k.f(x) is the graph of f(x) vertically stretched by a factor k.
- If 0 < k < 1, (a fraction), the graph of k.f(x) is the graph of f(x) vertically shrunk (or compressed) by a factor k.

3 Basic Graph Transformations

A **horizontal stretching** is the stretching of the graph away from the y-axis. A horizontal compression (or shrinking) is the squeezing of the graph towards the y-axis. A function f(k.x) stretches the graph of the function f(x) horizontally.

If k > 1, the graph of f(k.x) is the graph of f(x) horizontally shrunk (or compressed) by dividing each of its x-coordinates by k.

If 0 < k < 1 (a fraction), the graph is f(x) horizontally stretched by dividing each of its x-coordinates by k.

**Transformations of Function Graphs**

-f(x) | Reflect f(x) over x-axis |

f(-x) | Reflect f(x) over y-axis |

f(x) + k | Shift f(x) up by k units |

f(x) – k | Shift f(x) down by k units |

f(x + k) | Shift f(x) left by k units |

f(x – k) | Shift f(x) right by k units |

k.f(x) | Stretch f(x) vertically |

f(k.x) | Stretch f(x) hrozontally |

## Combination of Transformations

A function can be formed by applying two or more of the above combinations. For example again taking f(x) = x^{2} as a basic function, graph of f(x) = (x + 2)^{2} – 3 is obtained by translating graph of f(x) = x^{2}, 2 units leftwards and the again translating the graph 3 units downwards.

Now, let’s graph the function f(x) = x^{2} – 2x + 5

x^{2} – 2x + 5 = x^{2} – 2x + 1 + 4 = (x^{2} – 2×x×1 + 1^{2}) + 4 = (x – 1)^{2} + 4Therefore, graph of f(x) = x^{2} – 2x + 5 can be obtained by translating the graph of f(x) = x^{2}, 1 units rightwards and 4 units upwards.