Sunday, July 19, 2020

Solving Systems of Quadratic Equations

Solving Systems of Quadratic Equations

This blog entry looks at four systems of quadratic equations.

In each system, A, B, C, D, E, and F are constants and we are trying to solve for x and y.  Note:  please verify each solution but substituting the computed x and y back in the equations. 

System 1

A* x^2 + B* y = C
D* x^2 + E *y = F

A * x^2 + B * y = C
-A/D * (D * x^2 + E * y) = F * -A/D

I'm going to solve for y first. 

A* x^2 + B * y = C
-A * x^2 - (A * E)/D * y = -(A * F)/D

(B - A * E / D) * y = C  - (A * F)/D

y = (C  - A * F / D) / (B - A * E / D)

Let y0 = y and now solve for x:

A * x^2 + B * y0 = C
A * x^2 = C - B * y0
x^2 = 1 / A * (C - B * y0)
x = ±√( 1 / A * (C - B * y0) )

Summary:

A* x^2 + B* y = C
D* x^2 + E *y = F

y = (C  - A * F / D) / (B - A * E / D)
x = ±√( 1 / A * (C - B * y) )

Example:

Pictures are generated by the HP Prime emulator.



x^2 + 5 * y = 10
4 * x^2 + 4 / 9 * y = 100

A = 1, B = 5, C = 10, D = 4, E = 4/9, F = 100

y = (C  - A * F / D) / (B - A * E / D)
y = (10 - 1 * 100 / 4) / (5 - 1 * 4/9 / 4)
y = -135 / 44 ≈ -3.068181818

x^2 = ±√( 1 / 1 * (10 - 5 * -135/44) )
x^2 = ±√( 1115 / 44 )
x ≈ ±5.033975476

The two points are:
( 5.033975476, -3.0681818)
( -5.033975476, -3.0681818)

System 2

A * x^2 + B * y^2 = C
D * x^2 + E * y^2 = F

We'll start with solving for x:

A * x^2 + B * y^2 = C
-B * D / E * x^2 - B * y^2 = -B * F / E

(A - B * D / E) * x^2 = C - B * F / E

x^2 = (C - B * F / E) / (A - B * D / E)

x = ±√( (C - B * F / E) / (A - B * D / E) )

Let x0 = x

A * x0^2 + B * y^2 = C
B * y^2 = C - A * x0^2
y^2 = 1 / B * (C - A * x0^2)

y = ±√( 1 / B * (C - A * x0^2) )

Summary:

A * x^2 + B * y^2 = C
D * x^2 + E * y^2 = F

x = ±√( (C - B * F / E) / (A - B * D / E) )
y = ±√( 1 / B * (C - A * x0^2) )

Example:



3 * x^2 + y^2 = 25/16
36 * x^2 + y^2 = 4

A = 3, B = 1, C = 25/16, D = 36, E = 1, F =4

x = ±√( (25/16 - 1 * 4 / 1) / (3 - 1 * 36 / 1) )
x = ±√( 13/176 ) ≈ ± 0.271778653

x^2 = 13/176

y = ±√( 1 / 1 * (25/16 - 3 * 13/176) )
y = ±√( 59/44 ) ≈ ± 1.157976291

Solutions:

(0.271778653, 1.157976291)
(0.271778653, -1.157976291)
(-0.271778653, 1.157976291)
(-0.271778653, -1.157976291)

System 3

A * x^2 + B * y^2 = C
D * x^2 + E * y = F

A * x^2 + B * y^2 = C
-A / D * (D * x^2 + E * y) = F * -A / D

A * x^2 + B * y^2 = C
-A * x^2 + -A * E / D * y = -A * F / D

B * y^2 + -A * E / D * y = C - A * F / D

B * y^2 + -A * E / D * y  + (A * F / D - C) = 0

Once y is solved for, then:

A * x^2 = C - B * y^2
x^2 = 1 / A * (C - B * y^2)
x = ±√ ( 1 / A * (C - B * y^2) )

Summary:

A * x^2 + B * y^2 = C
D * x^2 + E * y = F

B * y^2 + -A * E / D * y  + (A * F / D - C) = 0
x = ±√ ( 1 / A * (C - B * y^2) )

Example: 



49/16 * x^2 + 16 * y^2 = 64
x^2 + 7 * y = 5

A = 49/16, B = 16, C = 4, D = 1, E = 7, F = 5

B = 16
-A * E / D = -343/16
A * F / D - C = -779/16

y1 ≈ -1.19804377
x1 ≈ ±3.659362053

y2 ≈ 2.538548127
x2 ≈ ±3.573490854i

Solutions (real numbers):
( 3.659362053, -1.19804377)
( -3.659362053, -1.19804377)

System 4

A * x^2 + B * y^2 = C
D * x + E * y = F

E * y = F - D * x
y = F/E - D/E * x
y^2 = (D/E)^2 * x^2 - 2 * D * F / E^2 * x + (F/E)^2

A * x^2 + B * ((D/E)^2 * x^2 - 2 * D * F / E^2 * x + (F/E)^2) = C
A * x^2 + B * ((D/E)^2 * x^2 - 2 * D * F / E^2 * x + (F/E)^2) - C = 0
A * x^2 + B * (D/E)^2 * x^2 - (2 * B * D * F / E^2) * x + ( B * (F/E)^2 - C ) = 0

Once the solutions for x are found, solve for y by:
y = F/E - D/E * x

Summary:

A * x^2 + B * y^2 = C
D * x + E * y = F

(A + B * (D/E)^2) * x^2 + (-2 * B * D * F / E^2) * x + ( B * (F/E)^2 - C ) = 0
y = F/E - D/E * x

Example 4:




5 * x^2 + 6 * y^2 = 15
-10 * x + 13 * y = 2

A = 5, B = 6, C = 15, D = -10, E = 13, F = 2

A + B * (D/E)^2 = 1445/169
-2 * B * D * F / E^2 = 240/169
B * (F/E)^2 - C = -2511/169

x1 ≈ 1.2537792907
y1 ≈ 1.105994544

x2 ≈ -1.403882873
y2 ≈ -0.926063748

I hope you find this helpful.

Eddie

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Fun with the HP 30b

Fun with the HP 30 b Introduction The following programs are for the HP 30b Business Professional. Did you know that the 30b...