# What are Functions? A Short and Simple Explanation

Understanding functions is vital for anyone intending to master calculus or learning mathematical physics. For those who have never heard of the concept of the function, here’s a quick introduction. A function f(x) is a mathematical expression, you can think of it as an input-output system, establishing a connection between one independent variable x and a dependent variable y. We “throw” in a certain value of x, do what the mathematical expression f(x) demands us to do, and get a corresponding value of y in return. Here’s an example of this:

The expression on the right tells us that when given a certain value of x, we need to multiply the square of x by 2, subtract 3x from the result and in a final step add one. For example, using x = 2, the function returns the value:

So this particular function links the input x = 2 to the output y = 3. This is called the value of the function f(x) at x = 2. Of course, we are free to choose any other value for x and see what the function does with it. Inserting x = 1, we get:

So given the input x = 1, the function produces the output y = 0. Whenever this happens, a value of zero is returned, we call the respective value of x a root of the function. So the above function has one root at x = 1. Let’s check a few more values:

The first line tells us that for x = 0, the value of the function lies on y = 1. For x = -1 we get y = 6 and for x = -2 the result y = 15. What to do with this? For one, we can interpret these values geometrically. We can consider any pair of x and y as a point P(x / y) in the Cartesian coordinate system. Since we could check every x we desire and calculate the corresponding value of y using the function, the function defines a graph in the coordinate system. The graph of the above function f(x) will go through the points P(2 / 3), P(1 / 0), P(0 / 1), P(-1, 6) and P(-2 / 15). Here’s the plot:

Graph of f(x) = 2x² – 3x + 1

You can confirm that the points indeed lie on the graph by following the x-axis, as usual the horizontal axis, and determining what distance the curve has from the x-axis at a certain value of x. For example, to find the point P(2 / 3), we move, starting from the origin, two units to the right along the x-axis and then three units upwards, in direction of the y-axis. Here we meet the curve, confirming that the graph includes the point P(2 / 3). Make sure to check this for all other points we calculated. Of course, to produce such a neat plot, we need to insert a lot more than just six values for x. This uncreative work is best done by a computer. Feel free to check out the easy-to-use website graphsketch.com for this, it doesn’t cost a thing and requires no registration. Note that the plot also shows a second root at x = 0.5, the point P(0.5 / 0). Let’s make sure that this value of x is a root of our function f(x) by inserting x = 0.5 and hoping that it produces the output y = 0:

As expected. This was all very mathematical, but what practical uses are there for functions? We can use them to establish a connection between the value of one physical quantity and another. For example, through experiments or theoretical considerations we can determine a function f(p) that links the air pressure p to the air density D. It would allow us to insert any value for the air pressure p and calculate the corresponding value for the air density D, which can be quite useful. Or consider a function f(v) that establishes a connection between the velocity v of an object and the frictional forces F it experiences. This is extremely helpful when trying to determine the trajectory of the object, yet another function f(t) that specifies the link between the elapsed time t and the position x of the object. Just to give you one example of this, the function:

connects the elapsed time t (in seconds) with the corresponding height h (in meters) for an object that is dropped from a 22 m tall tower. According to this function, the object will have reached the following height after t = 1 s:

Insert any value for t and the function produces the object’s location at that time. In this case we are particularly interested in the root. For which value of the independent variable t does the function return the value zero? In other words: after what time does the object reach the ground? We could try inserting several values for t and hope that we find the right one. A more promising approach is setting up the equation f(x) = 0 and solving for x. This requires some knowledge in algebra.

Subtracting 22 on both sides leads to:

Divide by -4.91:

And apply the square root:

For this value of t the function f(t) becomes zero (due to inevitable rounding errors, not perfectly though). The rounding errors are also why I switched from the “is equal to”-sign = to the “is approximately equal to”-sign ≈. You should do the same in calculations whenever rounding a value.

Graph of f(t) = -4.91t² + 22

As you can see, functions are indeed quite useful. If you had trouble understanding the algebra that led to the root t = 2.12, consider reading my free e-book “Algebra – The Very Basics” before continuing with functions.

This was an excerpt from my e-book Math Shorts – Exponential and Trigonometric Functions

# New Kindle Release: Math Shorts – Exponential and Trigonometric Functions

I’m on a roll here … another math book, comin’ right up … I’m happy to announce that today I’m expanding my “Math Shorts” series with the latest release “Math Shorts – Exponential and Trigonometric Functions”. This time it’s pre-calculus and thus serves as a bridge between my permanently free e-books “Algebra – The Very Basics” and “Math Shorts – Derivatives”. Without further ado, here’s the blurb and table of contents (click cover to get to the product page on Amazon):

Blurb:

Before delving into the exciting fields of calculus and mathematical physics, it is necessary to gain an in-depth understanding of functions. In this book you will get to know two of the most fundamental function classes intimately: the exponential and trigonometric functions. You will learn how to visualize the graph from the equation, how to set up the function from conditions for real-world applications, how to find the roots, and much more. While prior knowledge in linear and quadratic functions is helpful, it is not necessary for understanding the contents of the book as all the core concepts are developed during the discussion and demonstrated using plenty of examples. The book also contains problems along with detailed solutions to each section. So except for the very basics of algebra, no prior knowledge is required.

Once done, you can continue your journey into mathematics, from the basics all the way to differential equations, by following the “Math Shorts” series, with the recommended reading being “Math Shorts – Derivatives” upon completion of this book. From the author of “Great Formulas Explained” and “Statistical Snacks”, here’s another down-to-earth guide to the joys of mathematics.

1. Exponential Functions
1.1. Definition
1.2. Exercises
1.3. Basics Continued
1.4. Exercises
1.5. A More General Form
1.6. Exercises

2. Trigonometric Functions
2.1. The Sine Function
2.2. Exercises
2.3. The Cosine Function
2.4. Exercises
2.5. Roots
2.6. Exercises
2.7. Sine Squared And More
2.8. The Tangent Function
2.9. Exercises

3. Solutions to the Problems

# New Release for Kindle: Math Shorts – Derivatives

The rich and exciting field of calculus begins with the study of derivatives. This book is a practical introduction to derivatives, filled with down-to-earth explanations, detailed examples and lots of exercises (solutions included). It takes you from the basic functions all the way to advanced differentiation rules and proofs. Check out the sample for the table of contents and a taste of the action. From the author of “Mathematical Shenanigans”, “Great Formulas Explained” and the “Math Shorts” series. A supplement to this book is available under the title “Exercises to Math Shorts – Derivatives”. It contains an additional 28 exercises including detailed solutions.

Note: Except for the very basics of algebra, no prior knowledge is required to enjoy this book.

– Section 1: The Big Picture

– Section 2: Basic Functions and Rules

Power Functions
Sum Rule and Polynomial Functions
Exponential Functions
Logarithmic Functions
Trigonometric Functions

– Section 3: Advanced Differentiation Rules

I Know That I Know Nothing
Product Rule
Quotient Rule
Chain Rule

– Section 4: Limit Definition and Proofs

The Formula
Power Functions
Constant Factor Rule and Sum Rule
Product Rule

– Section 5: Appendix

Solutions to the Problems

# Recurrence Relations – A Simple Explanation And Much More

Recurrence relations are a powerful tool for mathematical modeling and numerically solving differential equations (no matter how complicated). And as luck would have it, they are relatively easy to understand and apply. So let’s dive right into it using a purely mathematical example (for clarity) before looking at a real-world application.

This equation is a typical example of a recurrence relation:

x(t+1) = 5 * x(t) + 2 * x(t-1)

At the heart of the equation is a certain quantity x. It appears three times: x(t+1) stands for the value of this quantity at a time t+1 (next month), x(t) for the value at time t (current month) and x(t-1) the value at time t-1 (previous month). So what the relation allows us to do is to determine the value of said quantity for the next month, given that we know it for the current and previous month. Of course the choice of time span here is just arbitrary, it might as well be a decade or nanosecond. What’s important is that we can use the last two values in the sequence to determine the next value.

Suppose we start with x(0) = 0 and x(1) = 1. With the recurrence relation we can continue the sequence step by step:

x(2) = 5 * x(1) + 2 * x(0) = 5 * 1 + 2 * 0 = 5

x(3) = 5 * x(2) + 2 * x(1) = 5 * 5 + 2 * 1 = 27

x(4) = 5 * x(3) + 2 * x(2) = 5 * 27 + 2 * 5 = 145

And so on. Once we’re given the “seed”, determining the sequence is not that hard. It’s just a matter of plugging in the last two data points and doing the calculation. The downside to defining a sequence recursively is that if you want to know x(500), you have to go through hundreds of steps to get there. Luckily, this is not a problem for computers.

In the most general terms, a recurrence relation relates the value of quantity x at a time t + 1 to the values of this quantity x at earlier times. The time itself could also appear as a factor. So this here would also be a legitimate recurrence relation:

x(t+1) = 5 * t * x(t) – 2 * x(t-10)

Here we calculate the value of x at time t+1 (next month) by its value at a time t (current month) and t – 10 (ten months ago). Note that in this case you need eleven seed values to be able to continue the sequence. If we are only given x(0) = 0 and x(10) = 50, we can do the next step:

x(11) = 5 * 10 * x(10) – 2 * x(0) = 5 * 10 * 50 – 2 * 0 = 2500

But we run into problems after that:

x(12) = 5 * 11 * x(11) – 2 * x(1) = 5 * 11 * 2500 – 2 * x(1) = ?

We already calculated x(11), but there’s nothing we can do to deduce x(1).

Now let’s look at one interesting application of such recurrence relations, modeling the growth of animal populations. We’ll start with a simple model that relates the number of animals x in the next month t+1 to the number of animals x in the current month t as such:

x(t+1) = x(t) + f * x(t)

The factor f is a constant that determines the rate of growth (to be more specific: its value is the decimal percentage change from one month to the next). So if our population grows with 25 % each month, we get:

x(t+1) = x(t) + 0.25 * x(t)

If we start with x(0) = 100 rabbits at month t = 0 we get:

x(1) = x(0) + 0.1 * x(0) = 100 + 0.25 * 100 = 125 rabbits

x(2) = x(1) + 0.1 * x(1) = 125 + 0.25 * 125 = 156 rabbits

x(3) = x(2) + 0.1 * x(2) = 156 + 0.25 * 156 = 195 rabbits

x(4) = x(3) + 0.1 * x(3) = 195 + 0.25 * 195 = 244 rabbits

x(5) = x(4) + 0.1 * x(4) = 244 + 0.25 * 244 = 305 rabbits

And so on. Maybe you already see the main problem with this exponential model: it just keeps on growing. This is fine as long as the population is small and the environment rich in ressources, but every environment has its limits. Let’s fix this problem by including an additional term in the recurrence relation that will lead to this behavior:

– Exponential growth as long as the population is small compared to the capacity
– Slowing growth near the capacity
– No growth at capacity
– Population decline when over the capacity

How can we translate this into mathematics? It takes a lot of practice to be able to tweak a recurrence relation to get the behavior you want. You just learned your first chord and I’m asking you to play Mozart, that’s not fair. But take a look at this bad boy:

x(t+1) = x(t) + a * x(t) * (1 – x(t) / C)

This is called the logistic model and the constant C represents said capacity. If x is much smaller than the capacity C, the ratio x / C will be close to zero and we are left with exponential growth:

x(t+1) ≈ x(t) + a * x(t) * (1 – 0)

x(t+1) ≈ x(t) + a * x(t)

So this admittedly complicated looking recurrence relation fullfils our first demand: exponential growth for small populations. What happens if the population x reaches the capacity C? Then all growth should stop. Let’s see if this is the case. With x = C, the ratio x / C is obviously equal to one, and in this case we get:

x(t+1) = x(t) + a * x(t) * (1 – 1)

x(t+1) = x(t)

The number of animals remains constant, just as we wanted. Last but not least, what happens if (for some reason) the population gets past the capacity, meaning that x is greater than C? In this case the ratio x / C is greater than one (let’s just say x / C = 1.2 for the sake of argument):

x(t+1) = x(t) + a * x(t) * (1 – 1.2)

x(t+1) = x(t) + a * x(t) * (- 0.2)

The second term is now negative and thus x(t+1) will be smaller than x(t) – a decline back to capacity. What an enormous amount of beautiful behavior in such a compact line of mathematics! This is where the power of recurrence relations comes to light. Anyways, let’s go back to our rabbit population. We’ll let them grow with 25 % (a = 0.25), but this time on an island that can only sustain 300 rabbits at most (C = 300). Thus the model looks like this:

x(t+1) = x(t) + 0.25 * x(t) * (1 – x(t) / 300)

If we start with x(0) = 100 rabbits at month t = 0 we get:

x(1) = 100 + 0.25 * 100 * (1 – 100 / 300) = 117 rabbits

x(2) = 117 + 0.25 * 117 * (1 – 117 / 300) = 135 rabbits

x(3) = 135 + 0.25 * 135 * (1 – 135 / 300) = 153 rabbits

x(4) = 153 + 0.25 * 153 * (1 – 153 / 300) = 172 rabbits

x(5) = 172 + 0.25 * 172 * (1 – 172 / 300) = 190 rabbits

Note that now the growth is almost linear rather than exponential and will slow down further the closer we get to the capacity (continue the sequence if you like, it will gently approach 300, but never go past it).

We can even go further and include random events in a recurrence relation. Let’s stick to the rabbits and their logistic growth and say that there’s a p = 5 % chance that in a certain month a flood occurs. If this happens, the population will halve. If no flood occurs, it will grow logistically as usual. This is what our new model looks like in mathematical terms:

x(t+1) = x(t) + 0.25 * x(t) * (1 – x(t) / 300)    if no flood occurs

x(t+1) = 0.5 * x(t)    if a flood occurs

To determine if there’s a flood, we let a random number generator spit out a number between 1 and 100 at each step. If it displays the number 5 or smaller, we use the “flood” equation (in accordance with the 5 % chance for a flood). Again we turn to our initial population of 100 rabbits with the growth rate and capacity unchanged:

x(1) = 100 + 0.25 * 100 * (1 – 100 / 300) = 117 rabbits

x(2) = 117 + 0.25 * 117 * (1 – 117 / 300) = 135 rabbits

x(3) = 135 + 0.25 * 135 * (1 – 135 / 300) = 153 rabbits

x(4) = 0.5 * 153 = 77 rabbits

x(5) = 77 + 0.25 * 77 * (1 – 77 / 300) = 91 rabbits

As you can see, in this run the random number generator gave a number 5 or smaller during the fourth step. Accordingly, the number of rabbits halved. You can do a lot of shenanigans (and some useful stuff as well) with recurrence relations and random numbers, the sky’s the limit. I hope this quick overview was helpful.

A note for the advanced: here’s how you turn a differential equation into a recurrence relation. Let’s take this differential equation:

dx/dt = a * x * exp(- b*x)

First multiply by dt:

dx = a * x * exp(- b * x) * dt

We set dx (the change in x) equal to x(t+h) – x(t) and dt (change in time) equal to a small constant h. Of course for x we now use x(t):

x(t+h) – x(t) = a * x(t) * exp(- b * x(t)) * h

Solve for x(t+h):

x(t+h) = x(t) + a * x(t) * exp(- b * x(t)) * h

And done! The smaller your h, the more accurate your numerical results. How low you can go depends on your computer’s computing power.

# From Simple to Compound Interest

Imagine you loan a bank the principal P = 10000 \$ at an interest rate of i = 5 %. This is the amount of interest you would receive with simple interest, given the duration t of the loan:

t = 1 year
→ I = 10000 \$ * 0.05 * 1 = 500 \$

t = 2 years
→ I = 10000 \$ * 0.05 * 2 = 1000 \$

t = 3 years
→ I = 10000 \$ * 0.05 * 3 = 1500 \$

As you can see, the interest grows linearly with the duration of the loan. For each additional year, you get an additional 500 \$, which is just 5 % of the principal 10000 \$. In other words: each year the interest rate is applied to the principal. How could that be any different?

Consider this: At the end of the first year, you’ll receive an interest payment in the amount of 500 \$. This means that your bank statement will now read 10000 \$ + 500 \$  = 10500 \$. So why not apply the interest rate to this updated value? This would lead to an interest payment of 10500 \$ * 0.05 = 525 \$ for the second year instead of just 500 \$.

Continuing this train of thought, at the end of the second year your bank statement would read 10000 \$ + 500 \$ + 525 \$ = 11025 \$. Again we would rather have the interest rate applied to this updated value instead of the unchanging principal. This would result in an interest payment of 11025 \$ * 0.05 = 551.25 \$ for the third year.

For comparison, here’s what the final pay out would be for the simple interest plan:

10000 \$ + 500 \$ + 500 \$ + 500 \$ = 11500 \$

And this is what we would get with the “not simple” interest plan, where we apply the interest rate to the updated amounts instead of the principal:

10000 \$ + 500 \$ + 525 \$ + 551.25 \$ = 11576.25 \$

The latter is called compound interest. It means that we include already paid interests in the calculation of next year’s interest, which leads to the amount received growing exponentially instead of linearly.

(This was an excerpt from “Business Math Basics – Practical and Simple”. You can get it here: http://www.amazon.com/Business-Math-Basics-Practical-Simple-ebook/dp/B00FXB8QSO/)

# Average Size of Web Pages plus Prediction

Using data from websiteoptimization.com I plotted the development of web page sizes over the years. I also included the exponential fit:

As you can see, the 1/2 MB mark was cracked in 2009 and the 1 MB mark was cracked in 2012. Despite the seemingly random fluctuations, an exponential trend is clearly visible. The power 0.3 indicates that the web page sizes doubles about every 2.3 years. Assuming this exponential trend continues we will have these average sizes in the coming years:

2013 – ca. 1600 kb
2014 – ca. 2100 kb
2015 – ca. 2900 kb

So the 2 MB will probably be cracked in 2014 and in 2015 we will already be close to the 3 MB mark. Of course the trend is bound to flat out, but at this point there’s no telling when it will happen.

If you like more Internet analysis, check out The Internet since 1998 in Numbers.

# Missile Accuracy (CEP) – Excerpt from “Statistical Snacks”

An important quantity when comparing missiles is the CEP (Circular Error Probable). It is defined as the radius of the circle in which 50 % of the fired missiles land. The smaller it is, the better the accuracy of the missile. The German V2 rockets for example had a CEP of about 17 km. So there was a 50/50 chance of a V2 landing within 17 km of its target. Targeting smaller cities or even complexes was next to impossible with this accuracy, one could only aim for a general area in which it would land rather randomly.

Today’s missiles are significantly more accurate. The latest version of China’s DF-21 has a CEP about 40 m, allowing the accurate targeting of small complexes or large buildings, while CEP of the American made Hellfire is as low as 4 m, enabling precision strikes on small buildings or even tanks.

Assuming the impacts are normally distributed, one can derive a formula for the probability of striking a circular target of Radius R using a missile with a given CEP:

p = 1 – exp( -0.41 · R² / CEP² )

This quantity is also called the “single shot kill probability” (SSKP). Let’s include some numerical values. Assume a small complex with the dimensions 100 m by 100 m is targeted with a missile having a CEP of 150 m. Converting the rectangular area into a circle of equal area gives us a radius of about 56 m. Thus the SSKP is:

p = 1 – exp( -0.41 · 56² / 150² ) = 0.056 = 5.6 %

So the chances of hitting the target are relatively low. But the lack in accuracy can be compensated by firing several missiles in succession. What is the chance of at least one missile hitting the target if ten missiles are fired? First we look at the odds of all missiles missing the target and answer the question from that. One missile misses with 0.944 probability, the chance of having this event occur ten times in a row is:

p(all miss) = 0.94410 = 0.562

Thus the chance of at least one hit is:

p(at least one hit) = 1 – 0.562 = 0.438 = 43.8 %

Still not great considering that a single missile easily costs 10000 \$ upwards. How many missiles of this kind must be fired at the complex to have a 90 % chance at a hit? A 90 % chance at a hit means that the chance of all missiles missing is 10 %. So we can turn the above formula for p(all miss) into an equation by inserting p(all miss) = 0.1 and leaving the number of missiles n undetermined:

0.1 = 0.944n

All that’s left is doing the algebra. Applying the natural logarithm to both sides and solving for n results in:

n = ln(0.1) / ln(0.944) = 40

So forty missiles with a CEP of 150 m are required to have a 90 % chance at hitting the complex. As you can verify by doing the appropriate calculations, three DF-21 missiles would have achieved the same result.

Liked the excerpt? Get the book “Statistical Snacks” by Metin Bektas here: http://www.amazon.com/Statistical-Snacks-ebook/dp/B00DWJZ9Z2. For more excerpts see The Probability of Becoming a Homicide Victim and How To Use the Expected Value.