Skip to content Skip to sidebar Skip to footer

Finding All Possible Quadratic Equations From Two Points

I'm trying to find all of the possible quadratic equations that can be found within a certain scenario. In this scenario, there are two static Cartesian points, and then there is a

Solution 1:

The general form of the parabolic functions (with a vertical axis) is

f(x)= ax² + bx +c

You impose that the points (x₁,y₁) and (x₂,y₂) must belong to the graph of the function.

That is,

y₁ = ax₁² + bx₁ +c
y₂ = ax₂² + bx₂ +c

From these we obtain

c = y₁ - ax₁² - bx₁
y₂ = ax₂² + bx₂ + (y₁ - ax₁² - bx₁) = a(x₂²-x₁²) + b(x₂-x₁) + y₁

With that restrictions, we can get rid of the parameters b and c:

    y₂ - y₁ - a(x₂² - x₁²)   y₂-y₁
b = ────────────────────── = ───── - a(x₁+x₂)
           x₂ - x₁           x₂-x₁

                y₂-y₁                       y₂-y₁
c = y₁ - ax₁² - ─────x₁ + a(x₁+x₂)x₁ = y₁ - ─────x₁ + ax₁x₂
                x₂-x₁                       x₂-x₁

So we have

             ┌ y₂-y₁            ┐                y₂-y₁
f(x) = ax² + │ ───── - a(x₁+x₂) │x + y₁ - ax₁² - ─────x₁ + a(x₁+x₂)x₁
             └ x₂-x₁            ┘                x₂-x₁ 

Simplifying a little,

       ┌          y₂-y₁ ┐                
f(x) = │a(x-x₂) + ───── │(x-x₁) + y₁
       └          x₂-x₁ ┘                

Varying a you get all the possible functions.

Solution 2:

You're on the right track. You're last equation gives you c in terms of a. Your second to last equation gives you b in terms of a. Substituting both of those into your general equation gives you all three coefficients in terms of a. Then a is the dynamic integer value you want to shape your curve.

Post a Comment for "Finding All Possible Quadratic Equations From Two Points"