# Restrict FindInstance to exact value

I would like to restrict the FindInstance function to exact values (ex. 2Pi/3)

The following doesn't work

FindInstance[a*Cos[b  x] +  c*Cos[d  x]^2 == 0 && ExactNumberQ[x], {x, a, b, c, d}, Reals, 2]


Thanks

• Q functions don't work in this setting, for example FindInstance[PrimeQ[x], x, PositiveIntegers] won't work because it's evaluated to False and Q functions are more of a programmatic construct than a boolean predicate you can put in a formula - it's kind of hard to explain. May 19 '21 at 17:56

If you first do the following, you'll get a simpler form of the equation which removes the $$\cos^2$$ using the double angle formula:

eqn = a*Cos[b x ] + c*Cos[d x]^2 == 0;
simplerEqn = FullSimplify[TrigReduce[eqn]];
(* c + 2 a Cos[b x] + c Cos[2 d x] == 0 *)


Then FindInstance has a better chance at finding solutions without weird Root objects:

sols = FindInstance[simplerEqn, {a, b, c, d, x}, Reals, 2]

(** {
{a -> 1/20 (-551 - 551 Cos[195447/25]) Sec[54253/50],
b -> 239/10, c -> 551/10, d -> 861/10, x -> -(227/5)},

{a -> 1/20 (663 + 663 Cos[39211/25]) Sec[108611/50],
b -> 313/10, c -> -(663/10), d -> 113/10, x -> -(347/5)}
} **)


Verify with TrigReduce[eqn[[1]] /. sols[[1]]] and TrigReduce[eqn[[1]] /. sols[[2]]] and they both give zero .

Five variables are too many for FindInstance, so

Table[FindInstance[a*Cos[b x]+c*Cos[d x]^2==0&&x!=0,{x,a,b,d},Reals],{c,0,1}]


{{{x -> -(15/2), a -> 0, b -> 171/10, d -> -(103/5)}}, {{x -> -(1/10), a -> -81, b -> 45 \[Pi], d -> -95 \[Pi]}}}

As we see, FindInstance tries to find simple solutions as far as it is possible.