MMA 14.0

Can somebody explain why the following evaluates to False:

MemberQ[1/y[x], y, Infinity]

  • 4
    $\begingroup$ Use MemberQ[1/y[x], y[_], Heads -> True] or MemberQ[1/y[x], y[_]] or MemberQ[1/y[x], _y]. $\endgroup$
    – Domen
    Commented May 13 at 11:25
  • $\begingroup$ Thank you for the workaround. $\endgroup$ Commented May 13 at 11:37
  • 1
    $\begingroup$ For this sort of test, I might use Not[FreeQ[expr, y]]. But it depends. It's not the same as @Domen's MemberQ[expr, _y]. Of course, they give the same result on expr = 1/y[x]. But not when expr = 1/y. So it depends on what is desired and what inputs are possible. $\endgroup$
    – Goofy
    Commented May 13 at 15:53

1 Answer 1


The FullFormof 1/y[x] is Power[y[x],-1]

Let's see what elements MemberQ say are present

# -> MemberQ[1/y[x], #, Infinity] & /@ {x, y, 1, -1, Power} 

Both Power and y are not elements, but Heads

As pointed out by @Domen, using the option Heads -> True will include the Heads in the search

enter image description here

# -> MemberQ[1/y[x], #, Infinity, Heads -> True] & /@ {x, y, 1, -1, 
  • 1
    $\begingroup$ Thanks a lot for pointing out that this is a question of "Head" $\endgroup$ Commented May 13 at 16:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.