Ask Question
22 July, 21:37

How do you write a function

+2
Answers (1)
  1. 22 July, 21:45
    0
    What is a Function?

    A function relates an input to an output.

    function cogs

    It is like a machine that has an input and an output.

    And the output is related somehow to the input.

    f (x)

    "f (x) = ... " is the classic way of writing a function.

    And there are other ways, as you will see!

    Input, Relationship, Output

    We will see many ways to think about functions, but there are always three main parts:

    The input

    The relationship

    The output

    Example: "Multiply by 2" is a very simple function.

    Here are the three parts:

    Input Relationship Output

    0 * 2 0

    1 * 2 2

    7 * 2 14

    10 * 2 20

    ...

    For an input of 50, what is the output?

    Some Examples of Functions

    x2 (squaring) is a function

    x3+1 is also a function

    Sine, Cosine and Tangent are functions used in trigonometry

    and there are lots more!

    But we are not going to look at specific functions ...

    ... instead we will look at the general idea of a function.

    Names

    First, it is useful to give a function a name.

    The most common name is "f", but we can have other names like "g" ... or even "marmalade" if we want.

    But let's use "f":

    f (x) = x^2

    We say "f of x equals x squared"

    what goes into the function is put inside parentheses () after the name of the function:

    So f (x) shows us the function is called "f", and "x" goes in

    And we usually see what a function does with the input:

    f (x) = x2 shows us that function "f" takes "x" and squares it.

    Example: with f (x) = x2:

    an input of 4

    becomes an output of 16.

    In fact we can write f (4) = 16.

    The "x" is Just a Place-Holder!

    Don't get too concerned about "x", it is just there to show us where the input goes and what happens to it.

    It could be anything!

    So this function:

    f (x) = 1 - x + x2

    Is the same function as:

    f (q) = 1 - q + q2

    h (A) = 1 - A + A2

    w (θ) = 1 - θ + θ2

    The variable (x, q, A, etc) is just there so we know where to put the values:

    f (2) = 1 - 2 + 22 = 3

    Sometimes There is No Function Name

    Sometimes a function has no name, and we see something like:

    y = x2

    But there is still:

    an input (x)

    a relationship (squaring)

    and an output (y)

    Relating

    At the top we said that a function was like a machine. But a function doesn't really have belts or cogs or any moving parts - and it doesn't actually destroy what we put into it!

    A function relates an input to an output.

    Saying "f (4) = 16" is like saying 4 is somehow related to 16. Or 4 → 16

    tree

    Example: this tree grows 20 cm every year, so the height of the tree is related to its age using the function h:

    h (age) = age * 20

    So, if the age is 10 years, the height is:

    h (10) = 10 * 20 = 200 cm

    Here are some example values:

    age h (age) = age * 20

    0 0

    1 20

    3.2 64

    15 300

    ...

    What Types of Things Do Functions Process?

    "Numbers" seems an obvious answer, but ...

    calculator

    ... which numbers?

    For example, the tree-height function h (age) = age*20 makes no sense for an age less than zero.

    codes ... it could also be letters ("A"→"B"), or ID codes ("A6309"→"Pass") or stranger things.

    So we need something more powerful, and that is where sets come in:

    various real numbers

    A set is a collection of things.

    Here are some examples:

    Set of even numbers: { ..., - 4, - 2, 0, 2, 4, ... }

    Set of clothes: {"hat","shirt", ... }

    Set of prime numbers: {2, 3, 5, 7, 11, 13, 17, ... }

    Positive multiples of 3 that are less than 10: {3, 6, 9}

    Each individual thing in the set (such as "4" or "hat") is called a member, or element.

    So, a function takes elements of a set, and gives back elements of a set.

    A Function is Special

    But a function has special rules:

    It must work for every possible input value

    And it has only one relationship for each input value

    This can be said in one definition:

    function sets X to Y

    Formal Definition of a Function

    A function relates each element of a set

    with exactly one element of another set

    (possibly the same set).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “How do you write a function ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers