Skip to content

A power of a polynomial is solved by inverting into itself, so the roots come back containing x #744

Description

@Rafael-SOWNet

f(x)^n = 0 is answered with expressions that still contain x, which cannot be roots of an equation in x. Measured on bcfefc26:

equation answered roots
(x^2 + x + 1)^2 = 0 { sqrt(-1 - x), -sqrt(-1 - x) } (-1 ± i·sqrt(3))/2
(x^2 + x + 1)^3 = 0 { sqrt(-1 - x), -sqrt(-1 - x) } the same
(x^2 + 2x + 3)^2 = 0 { sqrt(-3 - 2x), -sqrt(-3 - 2x) } -1 ± i·sqrt(2)
(x^3 + x + 1)^2 = 0 { (-1 - x)^(1/3), (-1/2 + i·sqrt(3)/2)(-1 - x)^(1/3), … } the three roots of the cubic
(x^2 + x)^2 = 0 { sqrt(-x), -sqrt(-x) } 0 and -1

What it looks like

x = sqrt(-1 - x) is the equation rearranged, not solved: x^2 + x + 1 = 0 moved to x^2 = -1 - x and the x^2 node inverted, with the x on the right left where it was. Nothing checks that the side being inverted against is free of the variable, so a fixed point is handed back as an answer.

The last row is the clearest, because it is not even a hard equation: (x^2 + x)^2 = 0 has the roots 0 and -1, and sqrt(-x) is neither.

It is only this shape

The same polynomials answer correctly by every other route, which is why this has not shown up before:

solve  x^2 + x + 1 = 0                      →  { (-1 - sqrt(-3))/2, (-1 + sqrt(-3))/2 }   correct
solve  (x^2 + x + 1)(x^2 + x + 2) = 0       →  all four, correct
solve  x^4 + 2x^3 + 3x^2 + 2x + 1 = 0       →  { -1/2 ± sqrt(-3/4) }                      correct
       (that is the expansion of the first row)

So it needs a power of a polynomial that is not itself of the form a·x^k + b — squaring x^2 - 2 is fine, because inverting x^2 = 2 leaves nothing behind.

Notes towards a fix

Dropping any root that still contains the variable would stop the nonsense, but on its own it turns these into the empty set, which is also wrong. f(x)^n = 0 has exactly the roots of f(x) = 0, and f(x) = 0 is already answered correctly, so the powered form wants routing to it rather than being descended into by the inverter. Expanding first also gives the right answer, as the third line above shows.

A root that mentions the variable it solves for is worth rejecting somewhere central regardless, as a check on this class of mistake.

How it was found

By a completeness sweep over polynomials built from factors whose roots were known before solving — 596 cases, checking not only that every returned root satisfies the equation but that every root that went in came back. This case returns two "roots" that satisfy nothing and cannot be evaluated, so substituting answers back does not catch it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions