4

I took Algebra and Geometry in high school, never thought I'd use them, then became a programmer. I guess I was wrong.

To date, I have the hardest time taking equations and "flipping them," ie: rewriting an equation to find the reverse. For the current problem I'm dealing with, I have a formula that converts floats to pounds using a given ratio:

pounds = float * (1.0 / ratio)

How do I flip this to take pounds and ratio and solve for float? What's the theory and logic behind this? I'd like to understand how it works so I can do it on my own. Can anyone walk me through how this would be done so I can understand how to change my formulae to solve things backwards?

float = ?
  • 1
    This line of code is equivalent to pounds = float / ratio which, if you multiply both sides by ratio, gives you float = pounds * ratio. – Chris Taylor Feb 07 '12 at 23:40
  • It's not exactly equivalent, as my ratio is usually less than one. – Naftuli Kay Feb 07 '12 at 23:45
  • 2
    It's still equivalent (multiplying by $1/x$ gives the same result as dividing by $x$). – Chris Taylor Feb 07 '12 at 23:48
  • Just thought I should edit to add that in some programming languages it won't be equivalent (though the two expressions are, mathematically, identical). For example, Python interprets / as integer division if both operands are integers, but as floating point division if one or more of the operands is a float. So the expression 3 / 2 evaluates to 1, but the expression 3 * (1.0 / 2) evaluates to 1.5. This is why we don't use dynamic programming languages for serious numerical applications! – Chris Taylor Feb 07 '12 at 23:56
  • 1
    Python 3 always uses floating point operations, unless otherwise noted ;) – Naftuli Kay Feb 08 '12 at 01:07
  • @NaftuliTzviKay Your question is probably appropriate for the nearly-in-beta-SE http://area51.stackexchange.com/proposals/64216/mathematics-learning-studying-and-education.

    Check out the proposal and commit to it if you're interested. Then we can get it off the ground and get the site in beta!

    – Xoque55 Mar 03 '14 at 04:48
  • @Xoque55 Now that site is 5 years in beta. Does this question belong there? – ReinstateMonica3167040 Apr 15 '19 at 23:40

1 Answers1

6

Given an equation, you may multiply (or divide) both sides by the same non-zero number without changing the solution set of the equation.

If you have $$ pounds=float\cdot{1\over ratio}; $$ and wish to solve for $float$; first multiply both sides by $ratio$: $$ ratio\cdot pounds = float\cdot{1\over ratio} \cdot ratio. $$ But ${1\over ratio} \cdot ratio =1$, so you have $$ ratio\cdot pounds = float. $$


The "flip" business, I presume, means to take the reciprocal of both sides of the equation. You can do this when it doesn't lead to division by zero, because it amounts to dividing both sides of the equation by each side. Given $$\tag{1} {pounds\over float}={1\over ratio} $$ "Flipping" yields: $$\tag{2} {float\over pounds}={ ratio\over 1} $$

You can see that you can get equation $(2)$ from equation $(1)$ by multiplying both sides of equation $(1)$ by $ratio$ first, then multiplying both sides of the resulting equation by $float/pounds$.


Generally, when solving equations of this type for a specific quantity, you first make sure that quantity is "upstairs" ("flip" if it isn't). Then divide both sides of the equation by what is necessary to get the quantity of interest on one side of the equation by itself.

For example, suppose you have equation $(1)$ and that you want to solve for $float"$.

First "flip" to get equation $(2)$.

To get $float$ by itself, multiply both sides of equation $(2)$ by $pounds$.

You obtain at the end $float=ratio\cdot pounds$.

Matt
  • 661
David Mitra
  • 74,748
  • I think the OP's "flip" is just a personal terminology for solving the equation, or perhaps for reinterpreting the equation to consider another variable to be the unknown. In particular, I don't see any indication that "flip" should have anything to do with reciprocals in particular. – hmakholm left over Monica Feb 07 '12 at 23:55
  • @HenningMakholm, yes exactly. I meant to take a given equation and solve for a different variable in the equation. – Naftuli Kay Feb 08 '12 at 01:10