The Student Room Group

Polynomial regression lines - solving for X

I'm having a nightmare with some math problems, if anyone is able to help I would very much appreciate it.

I've been tasked with plotting a graph with results of an experiment I conducted and then create a polynomial regression line. No problem.

I've created a graph and got my polynomial equation. The graph is as follows:
X axis = concentration
Y axis = absorbance

I also tested some samples of unknown concentration, but I have their Y value as I measured their absorbance level.

Now I just need to work out what their concentration was. How on earth do I find the X value given that I know the Y value? I'm clueless with maths like this.

Example of some samples and my equation:
Sample A = 3.0 absorbance
Sample B = 1.7275 absorbance

Equation: Y = -0.7731x^2 + 3.0458x + 0.034

Obviously the Y value is changing with each sample so I'm confused how Y always equals the equation above, because Y is not constant. I've plugged this into Wolfram alpha but it plots 2 different points on a graph and gives me 2 different answers?
Original post by Spudhead
I'm having a nightmare with some math problems, if anyone is able to help I would very much appreciate it.

I've been tasked with plotting a graph with results of an experiment I conducted and then create a polynomial regression line. No problem.

I've created a graph and got my polynomial equation. The graph is as follows:
X axis = concentration
Y axis = absorbance

I also tested some samples of unknown concentration, but I have their Y value as I measured their absorbance level.

Now I just need to work out what their concentration was. How on earth do I find the X value given that I know the Y value? I'm clueless with maths like this.

Example of some samples and my equation:
Sample A = 3.0 absorbance
Sample B = 1.7275 absorbance

Equation: Y = -0.7731x^2 + 3.0458x + 0.034

Obviously the Y value is changing with each sample so I'm confused how Y always equals the equation above, because Y is not constant. I've plugged this into Wolfram alpha but it plots 2 different points on a graph and gives me 2 different answers?


Hope this is of some help:

Y is a function of x. You may be familiar with something like y=x^2. Neither x nor y are constants, but the formula describes the relationship between the two variables.

When you create a regression line, you're working out the formula for the function that best fits the data you have.

Your data will only cover a certain range of x values. And the quadratic polynomial you have will be the best fit in that range. Outside that range it could go off all over the place.

I'd guess that in this case the concentration is restricted to the range 0 to 1.
When you have the Y value then you're only interested in the corresponding x values that fall within the valid range. Presumably there is only one of them. Other values outside the range for which the regression polynomial is valid, will be due to the function going off all over, and are not relevant.

You may be able to add a restriction to Wolfram that x lies in a certain range, and so produce only one result, but I'm not sufficiently familiar with Worlfram to tell you how to do that.
Reply 2
Original post by ghostwalker
Hope this is of some help:

Y is a function of x. You may be familiar with something like y=x^2. Neither x nor y are constants, but the formula describes the relationship between the two variables.

When you create a regression line, you're working out the formula for the function that best fits the data you have.

Your data will only cover a certain range of x values. And the quadratic polynomial you have will be the best fit in that range. Outside that range it could go off all over the place.

I'd guess that in this case the concentration is restricted to the range 0 to 1.
When you have the Y value then you're only interested in the corresponding x values that fall within the valid range. Presumably there is only one of them. Other values outside the range for which the regression polynomial is valid, will be due to the function going off all over, and are not relevant.

You may be able to add a restriction to Wolfram that x lies in a certain range, and so produce only one result, but I'm not sufficiently familiar with Worlfram to tell you how to do that.



Thank you very much for your reply. Judging by the answers given in Wolfram Alpha it seems you are right and only one answer is correct and the others are wildly off target.

Annoyingly however it doesnt show me how it derives these answers and which formula it is using. Wolfram wants me to pay to see the formula

I dont suppose you could be so kind as to tell me the formula for working out X when I have the Y value? At least then I can start working them out myself and know how to do it in the future.


Concentration seems to be above 1 also. In the known concentrations the limit was 1, with a 2.4 absorbance. However one of the unknown samples had an absorbance rate of 3.0 (the maximum limit of the photospectrometer) and so its value must be greater than 1. Wolfram tells me this is 1.76, but doesnt tell me how it got to that number.
Original post by Spudhead
Thank you very much for your reply. Judging by the answers given in Wolfram Alpha it seems you are right and only one answer is correct and the others are wildly off target.

Annoyingly however it doesnt show me how it derives these answers and which formula it is using. Wolfram wants me to pay to see the formula.

I dont suppose you could be so kind as to tell me the formula for working out X when I have the Y value? At least then I can start working them out myself and know how to do it in the future.


Concentration seems to be above 1 also. In the known concentrations the limit was 1, with a 2.4 absorbance. However one of the unknown samples had an absorbance rate of 3.0 (the maximum limit of the photospectrometer) and so its value must be greater than 1. Wolfram tells me this is 1.76, but doesnt tell me how it got to that number.


Since you're not a maths student:

The formula is a minor variation of the standard quadratic formula.

You may recall the two solutions to the quadratic, ax2+bx+c=0ax^2+bx+c=0, are given by:

x=b±b24ac2a\displaystyle x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

Your formula is ax2+bx+c=yax^2+bx+c=y

which we can rearrange to

ax2+bx+(cy)=0ax^2+bx+(c-y)=0

This is the form we desire in order to use the quadratic formula, with the minor variation that the constant term is now "c-y". So, we modify the solutions accordingly.

Your two solutions are given by:

x=b±b24a(cy)2a\displaystyle x=\frac{-b\pm\sqrt{b^2-4a(c-y)}}{2a}

I'd suggest trying this out with some of the values you've put into Wolfram.

Be aware that this is a "best fit" line, so your original data points will not usually lie on it, but just be very close to it. Plugging in their y values will not necessarily give their x values - though they will be close.

From the shape of the curve, you will get a unique solution for x between 0 and 2 approximately.
(edited 7 years ago)
Reply 4
Original post by ghostwalker
Since you're not a maths student:

The formula is a minor variation of the standard quadratic formula.

You may recall the two solutions to the quadratic, ax2+bx+c=0ax^2+bx+c=0, are given by:

x=b±b24ac2a\displaystyle x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

Your formula is ax2+bx+c=yax^2+bx+c=y

which we can rearrange to

ax2+bx+(cy)=0ax^2+bx+(c-y)=0

This is the form we desire in order to use the quadratic formula, with the minor variation that the constant term is now "c-y". So, we modify the solutions accordingly.

Your two solutions are given by:

x=b±b24a(cy)2a\displaystyle x=\frac{-b\pm\sqrt{b^2-4a(c-y)}}{2a}

I'd suggest trying this out with some of the values you've put into Wolfram.

Be aware that this is a "best fit" line, so your original data points will not usually lie on it, but just be very close to it. Plugging in their y values will not necessarily give their x values - though they will be close.

From the shape of the curve, you will get a unique solution for x between 0 and 2 approximately.



Thank you so much :smile:
Original post by Spudhead

...

Equation: Y = -0.7731x^2 + 3.0458x + 0.034
...


Is this equation going to be the same for all trials?

The title of your post indicated a regression, so I thought you might be doing some data-fitting to get the equation. But since it seems that you are already given the equation the data is supposed to fit, it is simply a matter of using the Quadratic Formula to solve the quadratic equation. A quadratic equation has two roots; if the discriminant is non-zero, those roots should be different. And hopefully one fits in the appropriate range.

"ghostwalker" gave a lot of good information regarding solving a quadratic equation.

Quick Reply

Latest