When we graph a function $f(x)$, there's a few ways we can modify it:

Using $f(ax + b) + c$ instead of $f(x)$ has a few effects:

- a seems to squash the function
- b slides us left/right
- c lifts us up/down
- Interactive example on Desmos

What's going on? Well, we're describing the visual result on the graph, but aren't describing that underlying process that made the change. Let's take a look at the root cause.

## f(ax) is fast forward

The "a" in f(ax) is a fast-forward factor. Normally, we experience time as "1 minute per minute" -- for every minute we wait, the world advances one minute into the future.

What if we saw life on fast forward?

Here, 1 minute passing to us (in our "x" timeline) means 2 minutes passed in the real world. Or 10 minutes, an hour, or a year.

On our timeline (x), time passes as normal. But our function, which determines the results we see, is being fed a modified timeline. While we leisurely stroll from x=1 to x=2, f has to jump from f(1) to f(2) to f(3) ... up to f(20). Here, f needs to graph 10 minutes of events while we casually waited one minute. Cramming more data points into the same time period is a squashed, sped-up graph.

Intuitively, "Squashing the graph" really means "running time faster".

## f(x + b) is an offset

A simpler version of time travel is a basic shift. If things happen *ahead* of schedule, what does that mean?

Imagine a German/Japanese city where the trains run an hour ahead of schedule.

The 4pm train arrives at 3pm. The 11am flight takes off at 10am. In other words, a dystopian hellscape.

If I managed not to burst into flames upon arriving, I'd describe the situation like this:

- Actual time: 10am
- Flight that leaves: 11am
- Flight = actual + 1

In other words, f(x + 1) means things run ahead of schedule. We think it's 3pm (x = 3), but the 4pm events are happening [f(4) is happening].

Again, this can be tricky: doesn't it seem like we remove time to make things happen earlier? This is our visual intuition fooling us: if it's 3pm but f is running the 4pm events, it's going ahead of schedule. Note that we *add* time to our watch in order to arrive early.)

See "slide to the left" as "ahead of schedule".

## f(x) + c is a bias

Adding a value to a function moves it vertically.

What's happening? Unbeknownst to f(x), we take take the final result and make it larger.

Intuitively, we have a "bias". When f(x) = 0, it's telling us "don't change, stay at 0". Except our default value isn't zero, it's `c`

. When f(x) says don't change, that means "use your default value, c".

See "sliding up the function" as "changing the default value".

(In neural networks, you might have a default value if there's zero input. A "default bias" is a nice way to describe this, vs. "vertically sliding the function".)

## Appendix: Chain Rule

In Calculus, the chain rule lets us compose functions. (Fancy phrase for cramming one function inside another.)

When we cram 2x inside of sin, and take the derivative, we get:

The chain rule tells us to take the derivative of the outer function (sin(2x) => cos(2x)) and multiply by the derivative of the inner function (2x => 2).

What's going on? Using the "derivative = slope" interpretation (not my favorite but good for graphing), we see this:

If we pick a point on the cycle (such as x = 1 radian), we find the slope there as

In other words, at x = 1, sin(x) has a nice upward slope of about 54%. Ok, great.

Now, what happens if we run sin(x) at twice the speed? Eat, eat, eat!

Well... the derivative (slope we see) should double! Compared to the original, sin(2x) runs through changes twice as fast as we do. 1 minute in our world means sin(2x) has chomped through 2 minutes of changes.

At the *corresponding point* in the cycle, we should expect double the slope. Let's make sure.

Instead of asking for x = 1, we know that same point on sin(2x)'s timeline is now x = 0.5. So let's ask for the derivative there:

Yay, the math worked!

We can mechanically describe the chain rule as a way to compose functions. But intuitively, we've strapped a fast-forward device inside our function, speeding up the changes we experience.

Regular sin(x) keeps its derivative between -1.0 and +1.0, the limits imposed by cos(x). But now we have a fast-forward trick to make sin(x) move as fast as we want.

Extra: Imagine we weren't fast-forwarding at a constant rate of 2; what if sped up more, the further along we went? That function could be sin(x * x), where one x is our regular location in the cycle, and the other x is our fast-forward rate. For fun (yes!), you can take the derivative of sin(x * x) (answer).

## Appendix: Exponential Functions

We can run the exponential function ($e^x$) ahead of schedule with $e^{x + b}$.

But we can rewrite this to:

In other words, running the exponential function "ahead of schedule" can be seen as the regular exponential function with a bigger starting point.

Normal exponentials start at 1.0 and begin compounding continuously. Instead, we can see it as starting with a bigger starting value from 1.0. (For example, $e^{x + 2}$ starts compounding from $e^2 = 7.389$.)

Depending on the function, interpretations other than "ahead of schedule" might make more sense.

Happy math.

SollyNovember 1, 2018 at 7:46 pmI could be wrong, but shouldn’t d/dx sin(2x) = d/dx sin(*x*) d/dx 2x?

kalidNovember 1, 2018 at 8:20 pmGreat question. With the chain rule, the outer function sin(blah) just knows the derivative will be d/dx sin(blah) = cos(blah), no matter what value blah happens to be.

It turns out blah is actually 2x, but sine doesn’t know that. I see it as machine that happens to fed an amount that is 2x, instead of the x it was expecting.

(Another way to see it: sin is actually getting numbers, like sin(2), sin(4), etc. It computes the derivative at the number given, not knowing that it is really being fed 2*1, 2*2, etc.)

I have more on the chain rule here but hope that intuition helps.

https://betterexplained.com/articles/derivatives-product-power-chain/

SollyNovember 2, 2018 at 3:46 amWhat prevents me from just saying that d/dx sin(2x) = cos(2x)?

PakNovember 2, 2018 at 4:29 amI feel like Khalid’s prior answer should have said:

d/dblah sin(blah) = cos(blah)

So indeed you could say (it would look strange but is correct) that (d/d(2x)) sin(2x) = cos(2x) where you simply substituted blah=2x

But you are interested in d/dx, not d/dblah,

so you need to apply d/dx = d/dblah * dblah/dx

SollyNovember 2, 2018 at 4:52 amI think I figured it out: sin(2x)’ = sin'(2x)*(2x)’

kalidNovember 27, 2018 at 7:51 pmGreat catch, it should have been d/dblah

enginistNovember 1, 2018 at 8:49 pmNewton taught himself math by studying Descartes’ dense but difficult “La Geometrie.” Descartes discovered the Cartesian coordinate system by watching a fly trace a curve across the ceiling.

kalidNovember 1, 2018 at 9:01 pmAmazing story, didn’t know that!

blatantbeatDecember 15, 2018 at 8:17 amNice post. In the exponential example, I took a moment to notice that e^b = C, might be worth writing out!