# Evaluating Functions

A function is a mapping between an input and an output. For example, the function \(f(x) = x^2\) takes an input \(x\) and returns its square \(x^2.\) In this case, \(f(2) = 2^2 = 4,\) \(f\big(\sqrt{3}\big) = \big(\sqrt{3}\big)^2 = 3,\) and so on. The key difference between a function and a more general relation is that for every input to a function, there is exactly one output.

What is the value of the function \( f(x) = 3x - 5 \) at \( x = 5 \)?

We see that we want to evaluate \( f(5) \), where \( f(x) = 3x-5 \). Thus,

\[ f(5) = 3(5)-5 = 15-5 = 10. \ _\square \]

Sometimes when mapping between an input and output, the input can be another function that maps to another input. This is called a composite function. When evaluating a composite function, first we compose the function and evaluate the result as we do any other function.

Given that \(f(x)=\frac{3x}{x-1}\) and \(g(x)=\frac{x}{1-2x}\) what is the value of the function \((f \circ g)(x)\) at \(x=1\)?

First compose the function:

\[\begin{align} (f \circ g)(x)= f\big(g(x)\big)=f\left( \frac { x }{ 1-2x } \right) &=\frac { 3\left( \frac { x }{ 1-2x } \right) }{ \frac { x }{ 1-2x } -1 }\\\\ &=\frac { 3x }{ 3x-1 }. \end{align}\]

Now, evaluate the function \(f\big(g(x)\big)=\frac { 3x }{ 3x-1}\) at \(x=1:\)

\[f\big(g(1)\big)=\frac{3(1)}{3(1)-1}=\frac{3}{2}.\ _\square\]

Given that \(f(x)=x^{2}-1, g(x) = x+1,\) and \(h(x)=2x\), what is the value of the function \((f\circ g\circ h)(x)\) at \(x=3\)?

First compose the function:

\[\begin{align} (f\circ g\circ h)(x)=f\Big(g\big(h(x)\big)\Big) &=f\big(h(x)+1\big)\\ &={ \big(h(x)+1\big) }^{ 2 }-1\\ &={ (2x+1) }^{ 2 }-1\\ &=4{ x }^{ 2 }+4x. \end{align}\]

Now, evaluate \(f\Big(g\big(h(x)\big)\Big)=4x^{2}+4x\) at \(x=3:\)

\[4(3)^{2}+4(3)=48.\ _\square\]

Given that \(f(x)=ax+3\) and \(g(x)=3x\), for what value of \(a\) is \((f\circ g)(4)=9\)?

Compose the function and evaluate at \(4:\)

\[(f\circ g)(4)=f\big(g(4)\big)=12a+3.\]

Equate this to \(9\) to obtain \[12a+3=9 \implies a=\frac { 1 }{ 2 } .\ _\square\]

What is the value of the function \(f(x)=(x-3)(x+13)(x-4)(x-6)+23\) at \(x=4\)?

We could just plug in \(4\) in every place of \(x,\) but notice that \(x-4=0\) when \(x=4,\) which will collapse all the product terms with it. Thus,

\[(x-3)(x+13)(0)(x-6)+23=0+23=23.\ _\square\]

Sometimes a function is given as a piecewise defined function, which is a function defined by multiple sub-functions. Each sub-function is defined by a certain interval or conditions.

Given the following function: \[ f(x)= \begin{cases} 3x+1 & x>3 \\ 2x & -1\le x\le 3\\ 3 & x<-1, \end{cases} \] what is the value of \(f(7)+f(3)+f(0)+f(-100)\)?

Based on the piecewised function above, if \(x>3,\) we evaluate over the function \(f(x)=3x+1.\) If \(x\) is between \(-1\) and \(3\) inclusive, then we evaluate over the function \(f(x)=2x.\) If \(x<-1,\) we evaluate over the function \(f(x)=3.\)

\[\begin{align} f( 7) +f(3) +f( 0 ) +f( -100 ) &=\big(3(7)+1\big)+\big(2(3)\big)+(2(0))+3\\ &=22+6+3\\ &=31.\ _\square \end{align}\]

**Cite as:**Evaluating Functions.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/evaluating-functions/