# How to rotate a function about the origin?

**URL:** <https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314>\
**Category:** Factual Questions\
**Created:** [January 17, 2010, 2:46pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314 "2010-01-17T14:46:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [January 17, 2010, 2:46pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/1 "2010-01-17T14:46:30Z")

</div>

I am trying to model something as an exponential function. The exponential function I first came up with is

y = b^x

However, I needed to reflect that curve across the x axis. That was easy:

y = b^(-x)

Now I need to rotate it 90[sup]o[/sup]. I can’t remember how to rotate a function. I’m sure I learned it in high school analytic geometry. Searches turn up how to do much more complex rotations, like rotating a curve in 3-space to create a surface for computer graphics purposes. I’m looking for something that I think should be pretty basic.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [January 17, 2010, 3:01pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/2 "2010-01-17T15:01:18Z")

</div>

I know how to rotate a linear function, and rotate a given point using a 2x2 rotation matrix. I just can’t figure out how to generalize it for an exponential function…

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [January 17, 2010, 3:10pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/3 "2010-01-17T15:10:09Z")

</div>

Doesn’t just swapping x and y do that?

---

<div class="post-metadata">

**Author:** ![Amblydoper](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@Amblydoper](https://boards.straightdope.com/u/Amblydoper)\
**Post date:** [January 17, 2010, 3:33pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/4 "2010-01-17T15:33:19Z")

</div>

> [@beowulff](#):
>
> Doesn’t just swapping x and y do that?

Yes, although you will have to restrict to domain in order for it to remain a function.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [January 17, 2010, 4:24pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/5 "2010-01-17T16:24:45Z")

</div>

It appears that switching to a logarithmic function works pretty well.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [January 17, 2010, 4:25pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/6 "2010-01-17T16:25:30Z")

</div>

> [@CookingWithGas](#):
>
> I know how to rotate a linear function, and rotate a given point using a 2x2 rotation matrix. I just can’t figure out how to generalize it for an exponential function…

The graph of your function is the set of 2-vectors of the form (x, b^(-x)). You can rotate the graph by multiplying each of those vectors by the appropriate rotation matrix, but getting a new equation of the form y = f(x) will require some clever algebraic manipulation.

> [@beowulff](#):
>
> Doesn’t just swapping x and y do that?

Swapping x and y is how you reflect the graph, not rotate it.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [January 17, 2010, 4:35pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/7 "2010-01-17T16:35:33Z")

</div>

I ended up using

y = c\*log(dx)

where c and d are arbitrary constants.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [January 17, 2010, 4:36pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/8 "2010-01-17T16:36:30Z")

</div>

> [@](#):
>
> Swapping x and y is how you reflect the graph, not rotate it.

Terminology aside, though, it sounds like that’s what the OP is actually trying to do.

---

<div class="post-metadata">

**Author:** ![Andy\_L](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Andy\_L](https://boards.straightdope.com/u/Andy_L)\
**Post date:** [January 17, 2010, 4:50pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/9 "2010-01-17T16:50:41Z")

</div>

> [@CookingWithGas](#):
>
> I ended up using
> 
> y = c\*log(dx)
> 
> where c and d are arbitrary constants.

What you’re doing is switching from one function (the exponential) to its inverse function (the logarithm). If you want to do the same flip with y=x^2, you’ll end up using y=sqrt(x). This amounts to swapping x and y as beowulff said.

---

<div class="post-metadata">

**Author:** ![Ponderoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ponderoid/32/19221_2.png) [@Ponderoid](https://boards.straightdope.com/u/Ponderoid)\
**Post date:** [January 18, 2010, 8:32pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/10 "2010-01-18T20:32:52Z")

</div>

> [@CookingWithGas](#):
>
> Now I need to rotate it 90[sup]o[/sup]. I can’t remember how to rotate a function. I’m sure I learned it in high school analytic geometry. Searches turn up how to do much more complex rotations, like rotating a curve in 3-space to create a surface for computer graphics purposes. I’m looking for something that I think should be pretty basic.

I’m a bit out of my depth here, but isn’t this an application of complex numbers? I think if you map onto the complex plane, and multiply by i, that will rotate everything by 90[sup]o[/sup]. If you’ve gone the wrong direction, try -i.

---

<div class="post-metadata">

**Author:** ![MikeS](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@MikeS](https://boards.straightdope.com/u/MikeS)\
**Post date:** [January 18, 2010, 9:42pm UTC](https://boards.straightdope.com/t/how-to-rotate-a-function-about-the-origin/525314/11 "2010-01-18T21:42:54Z")

</div>

You can do a quick-and-dirty rotation by replacing y with x everywhere it appears, and replacing x with (-y). (The minus sign there is what makes it a rotation rather than a reflection.) In other words, if you plot all the points in the plane satisfying y = f(x), then the points satisfying x = f(-y) will look like the same graph rotated 90[sup]o[/sup] clockwise about the origin. In your example, if you take

y = b[sup]x[/sup]

and do this swap, you end up with

x = b[sup]-y[/sup]

which, rearranging things, gives

y = - log[sub]b[/sub] x.

Of course, you can’t always write the relation x = f(-y) in the form y = g(x) — it’s just luck that you can do so here, and even in this case the domain of the function is only the positive real numbers, not all real numbers.
