# Unexpected behaviour of SolveAlways

My problem is quite simple and I cannot spot if this is my mistake or some malfunction of mathematica.

I am using

\$Version
"12.0.0 for Linux x86 (64-bit) (April 7, 2019)"


Here is the code

W := 1/2 (D[h1[x, y], x] D[h2[x, y], x] +
D[h1[x, y], y] D[h2[x, y], y])
N1 := 1/2 (D[h1[x, y], x]^2 + D[h1[x, y], y]^2) h1[x, y] h2[x, y] -
1/2 (D[h1[x, y], x] D[h2[x, y], x] +
D[h1[x, y], y] D[h2[x, y], y]) h1[x, y]^2
N2 := 1/2 (D[h2[x, y], x]^2 + D[h2[x, y], y]^2) h1[x, y] h2[x, y] -
1/2 (D[h1[x, y], x] D[h2[x, y], x] +
D[h1[x, y], y] D[h2[x, y], y]) h2[x, y]^2
lsq := 2 Sqrt[N2/W]


I am making an ansatz for the two functions

h1[x, y] = a x + b y + e;
h2[x, y] = c x + d y + f;


Then I am using

sltn = SolveAlways[lsq == 1, {x, y}]


which gives me some solutions. However, when I run the command

Table[{lsq} /. sltn[[i]], {i, 1, 14}] // TableForm


to make sure that lsq is indeed one, the results are Indeterminate and ComplexInfinity

What is happening?

• lsq is an ode depending on unknown functions h1[x,y], h2[x,y] . You really want to solve for x,y? – Ulrich Neumann Dec 11 '20 at 13:50
• @UlrichNeumann thanks for pointing that out. there was some code missing as I copied from my notebook. now it should be well formulated as a question. – DiSp0sablE_H3r0 Dec 11 '20 at 13:52
• Up to the documentation, SolveAlways works primarily with linear and polynomial equations. – user64494 Dec 11 '20 at 14:01
• @user64494 I know. However, this statement does not exclude all other cases, at least naively. And to be honest if SolveAlways is unable to find solutions, shouldn't it return the input as output rather than giving faulty solutions? – DiSp0sablE_H3r0 Dec 11 '20 at 14:03
• It's easily convertible to a polynomial system, which it probably does with generically valid transformations (squaring, multiplying both sides) that can introduce spurious solutions. Try ClearAll[h1, h2]; h1[x_, y_] = a x + b y + e; h2[x_, y_] = c x + d y + f; sltn = SolveAlways[lsq == 1 && (lsq^2 // Denominator) != 0, {x, y}]. – Michael E2 Dec 11 '20 at 14:24