\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amstext}
\usepackage{amssymb}


\newcommand{\ra}{\rightarrow}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\HH}{\mathbb{H}}
\newcommand{\sm}{\setminus}

\newtheorem{problem}{Problem}
\newtheorem{definition}{Definition}[section]
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{property}[definition]{Property}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{remark}[definition]{Remark}
\newtheorem{proposition}[definition]{Proposition}


\begin{document}

\begin{center}
{\LARGE Functions}
\end{center}

\section{$f(x)=3x-4$}
Lets play around with this function for a bit.
We can plug in a number by just putting that number where there was an $x$:
$f(5)=3(5)-4=11$.
Notice that since $5=3+2$ we can also plug in the $3+2$ and put that where
there was an $x$.
$f(5)=f(3+2)=3(3+2)-4=11$ and we get the same thing.

Here are some wrong way to do this:
$f(3+2)\neq f(3)+f(2)=5+2=7$.
$f(3+2) \neq f(3) + 2 =5+2 = 7$.

Lets try this with letters instead of numbers.
We still just do the same thing:  we put what ever is in the $()$ 
wherever there was an $x$.
$f(t+1)=3(t+1)-4=3t-1$.
$f(3a-5x+y)=3(3a-5x+y)-4$.
Here are some for you to try and simplify:

\begin{enumerate}
\item $f(2x)$
\item $f(2x-3)$
\item $f(x+h)$
\item $f(x-h)$
\end{enumerate}

\section{$g(x)=-3x^2+x$}

Lets try combining $f$ and $g$ several ways.
$f(g(x))$ means that what ever we plug in we first do what $g$ says to
do and then we do $f$ to that.
(This is called a composition of $f$ and $g$.)
Lets first do it with some numbers.
To find $f(g(2))$ we first need to find $g(2)$.
We know how to do this and we find that $g(2)=-10$.
Now we take this number and plug it into $f$.
So, $f(g(2))=f(-10)=-34$ after a little bit of computation.

Lets do this with letters now.
$f(g(x))=f(-3x^2+x)=3(-3x^2+x)-4$.\
Notice how we plugged the $x$ into $g$ and then plugged what we got
into $f$.

To find $f(g(x+h))$ we first need to find $g(x+h)$.
$g(x+h)=-3(x+h)^2+(x+h)$.  Now we take this and put it in $f$ for $x$.
So, $f(g(x+h))=f(-3(x+h)^2+(x+h))=3(-3(x+h)^2+(x+h))-4$.
You can simplify this if you want.

Heres some for you:
Let $A(x)=\frac{3x}{x^2-1}$ and $B(x)=-2x+1$.
\begin{enumerate}
\item  $A(B(x))$
\item  $B(A(x))$
\item  $A(x+h)$
\item  $B(x+h)$
\end{enumerate}

Of course there are a many more operations that you can do with functions.
For example: $f(x)+g(x)=(3x-4)+(-3x^2+x)$.
We can be more creative:
$1-g(2)+f(x+h)=1-(-3(2^2)+2)+3(x+h)-4$.

Heres some for you to try:
\begin{enumerate}
\item  $f(x+1)-f(x)$
\item  $\frac{g(x+h)-g(x)}{2h}$
\item  $f(x+1)+B(2x+2)$
\item  $\frac{f(x-1)}{g(x)}$
\end{enumerate}

\section{Working the other direction}
Sometimes it is nice to be able to write a function as a composition 
of two functions.
For example the function $Q(x)=\sqrt{3x^2-5}$ is a composition 
of the functions $S(x)=\sqrt{x}$ and $R(x)=3x^2-5$.
You can see that to get $Q$ we just plug $R$ into $S$.
So, $Q(x)=S(R(x))$.  (Work this out and make sure I'm not lying to you!)
But, this is not the only way to write $Q$ as a composition of functions.
You can check that if $C(x)=\sqrt{x-5}$ and $D(x)=3x^2$ then $Q(x)=C(D(x))$.
Here are some for you to write as a composition of two functions:
(This are lots of ways to do this!)
\begin{enumerate}
\item  $u(x)=(7x^3-x+1)^7$
\item  $v(x)=\frac{1}{3x^2-4}$
\item  $w(x)=\left( \frac{3x-1}{2x^3+1} \right)^3$
\item  $h(x)=\left( \frac{2}{x-1} \right)^2 - 3 \left( \frac{2}{x-1} \right)$
\end{enumerate}


\end{document}

