Jump to content

Recommended Posts

y = x*(x-1)*5;

 

Given $y, calculate $x.

 

I can get this far, it's been so long since I took a math class that I'm not even sure this makes sense.

y/5 = x*(x+1)

(y/5)/x = x+1

((y/5)/x)-1 = x

 

My problem is: Given $y = 60, how do I get $x = 4 (using php)

 

60 = x*(x-1)*5;

12 = x*(x-1);

12/x = x-1

(12/x)+1 = x

 

And I'm stuck. (I know $x = 4 because I made a spreadsheet plugging in 1-100 as x and then getting y, so where x = 4 y = 60)

Link to comment
https://forums.phpfreaks.com/topic/261856-reversing-an-equation/
Share on other sites

I don't get how that gives me x?

 

I see on wolfram alpha the two alternate forms but neither gives you x when you know y

 

I want to write a calculation in PHP that if I say I have 60 for y, it can tell me x = 4. Or y=100, and it tells me x = 5. And so on. If I give it 80 it should calculate for x and then round down to 4 but I can handle that part ;)

http://www.wolframalpha.com/input/?i=y+%3D+x*%28x-1%29*5+solve+for+x

 

Neat tool that wolfram alpha is.  I should use that more.

 

Seriously. I am bookmarking that site, I'd heard of it but never used it before. You guys rock.

 

So let's see in PHP this would be...

 

<?php
$y = 60;
$x = .1*((sqrt(5)*sqrt((4*$y)+5))+5);
echo $x;
?>

 

And it echoed 4. Perfect!!

 

 

  • 4 months later...

If you don't want to be big fat cheaters, the way to do this on paper is to use the quadratic formula For this equation, it's as easy as:

 

 

y = x*(x-1)*5;

 

y = 5x^2 - 5x; //jesi, you messed up here by moving X back to both sides of the equation. Don't do that

 

0 = 5x^2 - 5x - y; //everything has to equal zero

 

//here, we substitute Jesi's value for Y and use the Quadratic Formula

 

x = (5 +/- sqrt(25 - 4 * 5 * -60)) / 10;

 

x = (5 +/- 35) / 10;

 

x = 4,3;

 

The parabola formed by the equation cuts the Y axis at 4 and 3. Both are valid answers, but only the larger one satisfies the original equation.

 

Also, I just now noticed this thread is 6 months old and newbie here bumped it, but I did all the math so you're getting the post anyway.

Edited by ManiacDan
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.