I have met this problem and I do not know how to get rid of it. The problem is the following. I have defined a function h as sum of two functions f and g as follows:

h[x_, y_] := f[x, y] + g[x, y];

then, I have assumed that h is identically zero, that is,

$Assumptions = h[x_, y_] == 0;

Then, if I choose the variables, for instance,

Simplify[h[x_, y_] /. x -> z];

The output I obtain is


However, if I write

Simplify[(h[x_, y_] /. x -> z) + 3]

then the output is

3 + f[z_, y_] + g[z_, y_]

but I want 3 instead. In other words, I would like that any time the function h appears it is considered as equal to zero independently from the choice of the variables.

I really cannot understand why it does not work. I hope that someone can help me fix this. Thank you in advance!

  • $\begingroup$ How about adding the definition h[x_,y_]=0? $\endgroup$
    – mikado
    Mar 3, 2018 at 18:12
  • $\begingroup$ Related: (42607), (131515), (141973) $\endgroup$
    – Michael E2
    Mar 4, 2018 at 18:00
  • $\begingroup$ Do you want to simplify h[x_, y_] /. x -> z or h[x, y] /. x -> z? $\endgroup$
    – Michael E2
    Mar 4, 2018 at 18:16

1 Answer 1


If this does not answer your question, then treat it as a request for clarification.

I can't see what you are trying to accomplish with your code. If you are attempting to assume that h is identically zero for all variables, that is equivalent to defining

h[x_, y_] := 0

which would replace the previous definition

h[x_, y_] := f[x, y] + g[x, y]

rendering ir nor only irrelevant but null and void. To show this, let's do it in a local scope so that it doesn't affect your top-level definitions.

  h[x_, y_] := f[x, y] + g[x, y]; 
  h[x_, y_] = 0; 
  h[u, v] + 3]


Note that there is no need to introduce Simplify. Any call of h now evaluates to 0.

If your goal is to temporarily assume h is identically zero for the purpose of a specific evaluation, then Block is what you want. For example:

  h[x_, y_] = 0;
  Sqrt[h[u, v]] + 3]



This discussion is added to address the clarification given by the OP in a comment to this answer.

If you require f[x, y] + g[x, y] "in the code, it put it equal to zero independently from the variables inside", you are mathematically requiring that $g \equiv -f$, so just write and evaluate

g[x_, y_] := -f[x, y]


  1 + 3 f[x, y] + 2 g[x, y]
1 + f[x, y]
  1 + 2 f[x, y] + 3 g[x, y]
1 - f[x, y]
  • $\begingroup$ Thanks for your answer. I think my question is a little bit confusing. I try to explain it better. I would like that every time that I encounter an expression like f[x_,y_]+g[x_,y_] in the code, it put it equal to zero independently from the variables inside. $\endgroup$
    – Margot_12
    Mar 7, 2018 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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