Transformations of Functions Demo

Posted on 2017-05-15 by nbloomf
Tags: math

Given an equation in \(x\) and \(y\), if we replace all the instances of \(x\) with \(\frac{1}{a}(x-h)\), this has the effect of shifting the equation’s graph horizontally by \(|h|\) units (right if \(h\) is positive, left if negative) and stretching the graph horizontally by a factor of \(|a|\) with a flip across the \(y\)-axis if \(a\) is negative. Likewise, replacing all instances of \(y\) by \(\frac{1}{b}(y-k)\) gives a vertical shift and stretch.

The widget below is a live demonstration of these transformations. The graph of an equation is plotted on a pair of Cartesian axes, and the sliders below can be used to tweak the values of \(a\), \(b\), \(h\), and \(k\). The graph updates on the fly. You can select several different base equations using the drop-down menu. The Reset button sets \(a\) and \(b\) to 1 and \(h\) and \(k\) to 0.

Note that there is no cheating going on: the graph is drawn by checking, for each pixel, whether the equation has a solution nearby, and coloring that pixel black if so.

Normal Equations

Neat looking Equations

What about \(t\)?

If we replace all the \(x\)s with \(x\cos(t) - y\sin(t)\) and all the \(y\)s with \(x\sin(t) + y\cos(t)\), this rotates the graph about the origin by \(t\) radians (clockwise if \(t\) is positive and counterclockwise if negative). Here the rotation happens after the shifting and stretching, which is why fiddling with the \(h\) and \(k\) parameters when \(t\) is not zero don’t correspond to horizontal and vertical shifts. This demo also converts the \(t\) parameter from degrees.