Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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 = ?
share|improve this question
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 7 '12 at 23:40
    
It's not exactly equivalent, as my ratio is usually less than one. –  Naftuli Tzvi Kay Feb 7 '12 at 23:45
2  
It's still equivalent (multiplying by $1/x$ gives the same result as dividing by $x$). –  Chris Taylor Feb 7 '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 7 '12 at 23:56
    
Python 3 always uses floating point operations, unless otherwise noted ;) –  Naftuli Tzvi Kay Feb 8 '12 at 1:07

1 Answer 1

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$.

share|improve this answer
    
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. –  Henning Makholm Feb 7 '12 at 23:55
    
@HenningMakholm, yes exactly. I meant to take a given equation and solve for a different variable in the equation. –  Naftuli Tzvi Kay Feb 8 '12 at 1:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.