This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Wolfram Research, Inc.


3.3.10 Using Assumptions

Mathematica normally makes as few assumptions as possible about the objects you ask it to manipulate. This means that the results it gives are as general as possible. But sometimes these results are considerably more complicated than they would be if more assumptions were made.

Doing operations with assumptions.

Simplify by default does essentially nothing with this expression.

In[1]:= Simplify[1/Sqrt[x] - Sqrt[1/x]]


The reason is that its value is quite different for different choices of .

In[2]:= % /. x -> {-3, -2, -1, 1, 2, 3}


With the assumption , Simplify can immediately reduce the expression to 0.

In[3]:= Simplify[1/Sqrt[x] - Sqrt[1/x], x > 0]


Without making assumptions about and , nothing can be done.

In[4]:= FunctionExpand[Log[x y]]


If and are both assumed positive, the log can be expanded.

In[5]:= FunctionExpand[Log[x y], x > 0 && y > 0]


By applying Simplify and FullSimplify with appropriate assumptions to equations and inequalities you can in effect establish a vast range of theorems.

Without making assumptions about the truth or falsity of this equation cannot be determined.

In[6]:= Simplify[Abs[x] == x]


Now Simplify can prove that the equation is true.

In[7]:= Simplify[Abs[x] == x, x > 0]


This establishes the standard result that the arithmetic mean is larger than the geometric one.

In[8]:= Simplify[(x + y)/2 >= Sqrt[x y], x >= 0 && y >= 0]


This proves that lies in the range for all positive arguments.

In[9]:= FullSimplify[0 < Erf[x] < 1, x > 0]


An important class of assumptions are those which assert that some object is an element of a particular domain. You can set up such assumptions using x dom, where the character can be entered as AliasIndicatorelemAliasIndicator or \[Element].

Asserting that objects are elements of domains.

This confirms that is an element of the domain of real numbers.

In[10]:= Pi Element Reals


These numbers are all elements of the domain of algebraic numbers.

In[11]:= {1, Sqrt[2], 3 + Sqrt[5]} Element Algebraics


Mathematica knows that is not an algebraic number.

In[12]:= Pi Element Algebraics


Current mathematics has not established whether is an algebraic number or not.

In[13]:= E + Pi Element Algebraics


This represents the assertion that the symbol x is an element of the domain of real numbers.

In[14]:= x Element Reals


Domains supported by Mathematica.

If is assumed to be an integer, is zero.

In[15]:= Simplify[Sin[n Pi], n Element Integers]


This establishes the theorem if is assumed to be a real number.

In[16]:= Simplify[Cosh[x] >= 1, x Element Reals]


If you say that a variable satisfies an inequality, Mathematica will automatically assume that it is real.

In[17]:= Simplify[x Element Reals, x > 0]


By using Simplify, FullSimplify and FunctionExpand with assumptions you can access many of Mathematica's vast collection of mathematical facts.

This uses the periodicity of the tangent function.

In[18]:= Simplify[Tan[x + Pi k], k Element Integers]


The assumption k/2 Integers implies that k must be even.

In[19]:= Simplify[Tan[x + Pi k/2], k/2 Element Integers]


Mathematica knows that for positive .

In[20]:= Simplify[Log[x] < Exp[x], x > 0]


FullSimplify accesses knowledge about special functions.

In[21]:= FullSimplify[Im[BesselJ[0, x]], x Element Reals]


Mathematica knows about discrete mathematics and number theory as well as continuous mathematics.

This uses Wilson's Theorem to simplify the result.

In[22]:= FunctionExpand[Mod[(p - 1)!, p], p Element Primes]


This uses the multiplicative property of the Euler phi function.

In[23]:= FunctionExpand[EulerPhi[m n], {m, n} Element Integers &&

GCD[m, n] == 1]