# Functions === ###### tags: `Functions` `Calc1` `Calc2` --- **Definition:** A function consists of three things: * a set called the *domain* * a set called the *codomain* * a *rule* that assigns each element of the domain to an element of the codomain --- Sometimes these careful definitions are helpful, but it usually helps to see some examples. --- # <span style="color:blue"> Example </span> ## <span style = "color:red"> A function with a domain of numbers </span> We will call this function $a$: * **Domain:** {1, 2, 3} * **Codomain:** {2, 4, 6} * **Rule:** multiply x by two, i.e. $a(x) = 2x$ for all x in {1, 2, 3} --- # :bulb: ## Functions can be described or expressed in <span style="color:#0F000F">many different ways. </span> --- # You're probably used to seeing functions as <span style = "color:red"> **formulas**. </span> --- # <span style = "color:red"> **formulas**. </span> A symbolic rule like $$ g(x) = x^2 $$ is incredibly useful, since it tells us immediately how to calculate the output. --- # <span style = "color:blue"> Other Ways of Describing Functions </span> --- ## <span style = "color:red"> (Lookup) Table </span> ![](https://i.imgur.com/Q3XduCa.png) --- # <span style = "color:blue"> Functions Can Work On Anything </span> Previous experience with functions like $$g(x) = x^2$$ sometimes leads people to believe that functions (and mathematics in general) only work on numbers. ** Any set can be the domain of a function. ** --- # <span style = "color:blue"> Example 3 </span> ## <span style = "color:red"> </span> Consider the function **word_length**. 1. the **domain** is the set of all valid English words 2. the **codomain** is $\mathbb{Z}$ -- the set of integers 3. the **value** of a word is the number of letters in that word. For instance, * word_length(zoo) = 3, * word_length(four) = 4, * word_length(BITCOIN) = 7. --- # <span style = "color:blue"> Example </span> ## <span style = "color:red"> A function which reverses words </span> We define a function reverse which has * **domain**: the set of all English words. * **codomain**: the set of all strings over the English alphabet * **rule**: the word is written letter-by-letter in reversed order. For instance, * reverse(CAT) = TAC, * reverse(ethereum) = muereht, * reverse(math) = htam. --- # <span style="color:blue"> Example </span> ## <span style="color:red"> The 92-function </span> * **Domain**: The set of all 2021 WCU students. * **Codomain**: 9-digit numbers that begin with "92" * **Rule**: Given a student, return their lookup number. I don't have any exampples here, because I'm not going to give away anyone's 92-number. This is still useful for understanding the concept. --- # <span style = "color:#F300FF">You Try It Return to the asynchronous class on folder Blackboard now, and answer the questions in the "Examples of Functions" Activity. </span> ---
{"metaMigratedAt":"2023-06-15T19:46:22.057Z","metaMigratedFrom":"Content","title":"Functions","breaks":true,"contributors":"[{\"id\":\"0ef44b93-b06b-4bdd-9671-ec2854cb4a39\",\"add\":2947,\"del\":13}]"}
    326 views