Evaluating Functions
Evaluating Functions
To evaluate a function is to:
Replace (substitute) its variable with a given number or expression.
Like in this example:
Example: evaluate the function f(x) = 2x+4 for x=5
Just replace the variable "x" with "5":
f(5) = 2×5 + 4 = 14
Answer: f(5) = 14
More Examples
Here is a function:
f(x) = 1 - x + x^{2}
Important! The "x" is just a place-holder! And "f" is just a name.
It would be the same function if I wrote:
- f(q) = 1 - q + q^{2}
- w(A) = 1 - A + A^{2}
- h(θ) = 1 - θ + θ^{2}
Evaluate For a Given Value:
Let us evaluate that function for x=3:
f(3) = 1 - 3 + 3^{2} = 1 - 3 + 9 = 7
Evaluate For a Given Expression:
Evaluating can also mean replacing with an expression (such as 3m+1 or v^{2}).
Let us evaluate the function for x=1/r:
f(1/r) = 1 - (1/r) + (1/r)^{2}
Or evaluate the function for x=a-4:
f(a-4) | = 1 - (a-4) + (a-4)^{2} |
= 1 - a + 4 + a^{2} - 8a + 16 | |
= 21 - 9a + a^{2} |
Another Example
You can use your ability to evaluate functions to find other answers:
Example: h(x) = 3x^{2} + ax - 1,
- You are told that h(3) = 8, can you work out what "a" is?
First, evaluate h(3): | h(3) = 3×(3)^{2} + a×3 - 1 | |
Simplify: | h(3) = 27 + 3a - 1 | |
h(3) = 26 + 3a | ||
Now ... we know that h(3) = 8, so: 26 + 3a = 8 |
||
Move 26 to other side: | 3a = 8 - 26 = -18 | |
Divide by 3: | a = -6 |
Check:
h(x) = 3x^{2} - 6x - 1
h(3) = 3(3)^{2} - 6·3 - 1 = 27 - 18 - 1 = 8
Careful!
I recommend putting the substituted values inside parentheses () , so you don't make mistakes.
Example: evaluate the function h(x) = x^{2}+2 for x = -3
Replace the variable "x" with "-3":
h(-3) = (-3)^{2}+2 = 9+2 = 11
Without the () you could make a mistake:
h(-3) = -3^{2}+2 = -9+2 = -7 (WRONG!)
Also be careful of this:
f(x+a) is not the same as f(x) + f(a)
Example: g(x) = x^{2}
g(w+1) = (w+1)^{2} = w^{2} + 2w + 1
g(w) + g(1) = w^{2} + 1^{2} = w^{2} + 1
Different Result!