Documentation Center

  • Trials
  • Product Updates


Check whether equation or inequality holds for all values of its variables




isAlways(cond) checks whether the condition cond is valid for all possible values of symbolic variables in cond. When verifying the validity of cond, isAlways takes into account all assumptions set on the variables in cond. If the condition holds, isAlways returns logical 1 (true). Otherwise it returns logical 0 (false).

isAlways(cond,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Input Arguments


Equation, inequality, or vector or matrix of equations or inequalities. You also can combine several conditions by using the logical operators and, or, xor, not, or their shortcuts.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


One of these strings: false, true, or error. If isAlways cannot determine whether the specified condition holds for all values of its variables and at the same time cannot prove that the condition does not hold, then the function can return logical 0 or 1 or throw an error. By default, it returns logical 0 (false). If you specify true, then isAlways will return logical 1 (true) when it cannot decide whether the condition holds or not. If you specify error, isAlways will throw an error.

Default: false


Check whether this inequality is valid for all values of x:

syms x
isAlways(abs(x) >= 0)
ans =

Now check whether this equation is valid for all values of x:

isAlways(sin(x)^2 + cos(x)^2 == 1)
ans =

Check if at least one of the following two conditions is valid. To check if at least one of several conditions is valid, combine these conditions by using the logical operator or or its shortcut |.

syms x
isAlways(sin(x)^2 + cos(x)^2 == 1 | x^2 > 0)
ans =

Check the validity of this inequality. When isAlways cannot determine whether the condition is valid, it returns logical 0 by default:

syms x
isAlways(2*x >= x)
ans =

To change this default behavior, use Unknown. For example, specify that isAlways must return logical 1 if it cannot determine the validity of this inequality:

isAlways(2*x >= x,'Unknown','true')
ans =

Instead of true, you can also specify error. In this case, isAlways will throw an error if it cannot determine the validity of the condition.


Check validity of this inequality under the assumption that x is positive. When isAlways determines validity of an equation or inequality, it takes into account assumptions on variables in that equation or inequality:

syms x
assume(x < 0)
isAlways(2*x < x)
ans =

For further computations, clear the assumption on x:

syms x clear

See Also

| | | | | | | | |

Was this topic helpful?