# How do I define if two variables are equal to each other

Let's say I have the function x + y = z and I know that x = y. How can I define this in Mathematica?

I tried using

x + y == z x == z


Kind regards

Sam

I have a formula (x1+x2)/2=kand i'm given the information that x1=x2=2 for example. Is there anyway to define this in Mathematica?

• Can you explain in full what you are trying to achieve? Your question based on the assumption that it is possible to 'define' such a thing in general. It is not. Some context is necessary to answer the question. – Szabolcs May 23 at 11:25
• this looks like XY question. in which the real issue, X, of the person asking for help is obscured, because instead of asking directly about issue X, they ask how to solve a secondary issue, Y, which they believe will allow them to resolve issue X. – Nasser May 23 at 12:33
• If you know that x == y, then use the replacement rule y -> x, e.g., x + y == z /. y -> x. If you want the substitution to always be made, use Set, i.e., y = x. – Bob Hanlon May 23 at 15:02