Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168769
Image: ubuntu2004

This chapter is about:

1) Translations
2) Reflections
3) Scale Changes
4) Function Composition
5) Inverse Functions
6) zz-Scores

=================================

1)  Translations

You can think of a translation TT as a kind of function that operates on a point:  T(x,y)=(x+h,y+k)T(x, y) = (x+h, y+k)

If f(x)f(x) is some algebraic function, and if all of the points in its graph are translated by TT,

then the new function g(x)g(x) that describes those points will be g(x)=f(xh)+kg(x) = f(x-h) + k.

def T(x, y): return (x+2, y-3) L = [(0, 0), (3, 4), (-1, 5)] L
[(0, 0), (3, 4), (-1, 5)]
[T(x, y) for (x, y) in L]
[(2, -3), (5, 1), (1, 2)]
@interact def _(h = (-5..5), k = (-5..5)): def T(L): return [(x+h, y+k) for (x, y) in L] def f(x): return x^2 F = [(x, f(x)) for x in [-5..5]] def g(x): return f(x-h) + k G = T(F) print 'T(x, y) = (x +',h,', y +',k,')' print '\nf(x) = x^2' print F print '\ng(x) = (x-',h,')^2 + ', k print G show(points(G, color = 'red') + points(F) + plot(g, -5+h, 5+h, color = 'red') + plot(f, -5, 5))
[removed]
[removed]
[removed]
[removed]

If f(x)=x2f(x) = x^2 and g(x)=(x3)2g(x) = (x-3)^2 , then the graph of gg will look just like the graph of ff shifted horizontally 3 units.

But in which direction?  To the left or to the right of ff?

You might expect gg to appear to the left, because of the (x3)(x-3).

But no, it actually appears to the right.  This fact is often confusing to students.

Here is another interactive cell to experiment with just horizontal shifts:

@interact def horizontal_translation(h = (-10..10)): f(x) = x^2 g(x) = f(x-h) print 'g(x) = f(x - ',h,')' show(plot(f, -5, 5) + plot(g, -5+h, 5+h, color = 'red'))
[removed]
[removed]
[removed]
[removed]

We say that gg is the image and that ff is the pre-image (original). 

Now suppose that g(x)=x2+3g(x) = x^2 + 3.

 The graph of gg will look just like the graph of ff shifted vertically 3 units.

But in which direction?  Above or below ff?

You might expect gg to appear above, because of the +3+3.

And yes, that's what happens.  This fact is usually not confusing to students:

 

@interact def translate(k = (-25..25)): f(x) = x^2 g(x) = f(x) + k show(plot(f, -5, 5)+plot(g, -5, 5, color = 'red'))
[removed]
[removed]
[removed]
[removed]

Here are both kinds of translations put together:

@interact def translate(h = (-5..5), k = (-5..5)): f(x) = x^2 g(x) = f(x - h) + k print 'g(x) = f(x -',h,') +',k show(plot(f, -5, 5)+plot(g, -5+h, 5+h, color = 'red')+points([(0,0), (h, k)], color = 'black', pointsize = 25), ymax = 25)
[removed]
[removed]
[removed]
[removed]

Summary: 

If T(x,y)=(x+h,y+k)T(x, y) = (x + h, y + k), then g(x)=f(xh)+kg(x) = f(x - h) + k where

ff is some function and gg is the translated function.

2)  Reflections

Reflection over the yy axis:      ry(x,y)=(x,y)r_y(x, y) = (-x, y)

Reflection over the xx axis:      rx(x,y)=(x,y)r_x(x, y) = (x, -y)

f(x) = 2^x def r_y(L): return [(-x, y) for (x, y) in L] F = [(x, f(x)) for x in [-5..5, step = 1/5]] show(points(F)+points(r_y(F), color = 'red'))
def r_x(L): return [(x, -y) for (x, y) in L] show(points(F)+points(r_x(F), color = 'red'))
@interact def reflections(r_x = [False, True], r_y = [False, True]): f(x) = 2^x g(x) = f(x) if r_x: g(x) = -g(x) if r_y: g(x) = g(-x) show(plot(g, -5, 5, color = 'red')+plot(f, -5, 5), ymin = -25, ymax = 25)
r_x 
r_y 
[removed]
[removed]
[removed]
[removed]

Note \rightarrow A reflection over both the xx and yy axes is equivalent to a reflection over the origin.

Reflection over (0,0)(0, 0):      r(0,0)(x,y)=(x,y)r_{(0, 0)}(x, y) = (-x, -y)

A reflection over the line y=xy = x swaps the xx and yy coordinates:  ry=x(x,y)=(y,x)r_{y = x}(x, y) = (y, x)

f(x) = 2^x F = [(x, f(x)) for x in [-5..5, step = 1/5]] G = [(y, x) for (x, y) in F] I = [(F[0][0], F[0][0]), (G[-1][0], G[-1][0])] show(points(F) + points(G, color = 'red') + line(I, color = 'black'), aspect_ratio = 1)

3)  Scale Changes

S(x,y)=(ax,by)S(x, y) = (ax, by)

@interact def _(a = (-5..5), b = (-5..5)): def S(L): return [(a*x, b*y) for (x, y) in L] def f(x): return x^2 F = [(x, f(x)) for x in [-5..5]] def g(x): return f(x/a)*b G = S(F) print 'S(x, y) = (',a,'x, ',b,'y)' print '\nf(x) = x^2' print F print '\ng(x) = (x/',a,')^2 * ', b print G show(points(G, color = 'red') + points(F) + plot(g, -5*abs(a), 5*abs(a), color = 'red') + plot(f, -5, 5))
[removed]
[removed]
[removed]
[removed]

Summary:

If S(x,y)=(ax,by)S(x, y) = (ax, by), then g(x)=f(x/a)bg(x) = f(x/a)\cdot b where

ff is some function and gg is the scaled function.

4)  Function Composition

Function composition means creating new functions from combinations of other functions.

f(x) = x^2 g(x) = 4*x
f(g(x))
16*x^2
g(f(x))
4*x^2

Note - function composition is not generally commutative!

5)  Inverse Functions

If f(x)f(x) and g(x)g(x) are inverse functions, then f(g(x))=g(f(x))=xf(g(x)) = g(f(x)) = x.

f(x) = pow(2, x) g(x) = log(x, 2) show(plot(f, -5, 5)+plot(g, 1/32, 32, color = 'red')+plot(x, -5, 32, color = 'black'), aspect_ratio = 1)

6)  zz-scores

z(x)=xμσz(x) = \frac{x - \mu}{\sigma}

A zz-score is a translation followed by a scale change:

T(x)=xμT(x) = x - \mu

S(x)=1σxS(x) = \frac{1}{\sigma}x

S(T(x))=xμσS(T(x)) = \frac{x - \mu}{\sigma}

@interact def normal_curve(m=75, s=10): z(x) = (x-m)/s P(x) = 1/(s*sqrt(2*pi*exp(z(x)^2))) show(plot(P, m-3*s, m+3*s)+\ line([(m,0),(m,P(m))], color = 'red', linestyle = '--')+\ line([(m-s,0),(m-s,P(m-s))], color = 'red', linestyle = '--')+\ line([(m+s,0),(m+s,P(m+s))], color = 'red', linestyle = '--')+\ line([(m-2*s,0),(m-2*s,P(m-2*s))], color = 'red', linestyle = '--')+\ line([(m+2*s,0),(m+2*s,P(m+2*s))], color = 'red', linestyle = '--'))
[removed]
[removed]
[removed]
[removed]