Get Started »

# Algebra

You can factor or expand algebraic expressions:

(Use CTRL+6 for typeset exponents.)
 In[1]:= ⨯ `Factor[x^2 + 2 x + 1]`
 Out[1]=

The Wolfram Language uses == (two equal signs) to test equality:

 In[1]:= ⨯ `2 + 2 == 4`
 Out[1]=

Combine algebraic expressions with == to represent an equation:

 In[2]:= ⨯ `1 + z == 15`
 Out[2]=

Commands like Solve find exact solutions to equations:

 In[1]:= ⨯ `Solve[x^2 + 5 x - 6 == 0, x]`
 Out[1]=

For approximate results, use NSolve:

 In[2]:= ⨯ `NSolve[7 x^2 + 3 x - 5 == 0, x]`
 Out[2]=

Pass in a system of equations as a list:

 In[3]:= ⨯ `Solve[{x^2 + 5 == y, 7 x - 5 == y}, {x, y}]`
 Out[3]=

Find the roots of an equation:

(|| is the symbol for Or.)
 In[1]:= ⨯ `Roots[x^2 + 3 x - 4 == 0, x]`
 Out[1]=

If a polynomial is not easily factorable, approximate results may be more useful:

 In[2]:= ⨯ `NRoots[360 + 234 x - 1051 x^2 + 11 x^3 + 304 x^4 - 20 x^5 == 0, x]`
 Out[2]=

The Reduce command reduces a set of inequalities into a simple form:

(Type <= for the `≤` symbol.)
 In[1]:= ⨯ `Reduce[{0 < x < 2, 1 <= x <= 4}, x]`
 Out[1]=

The reduced form may include multiple intervals:

 In[2]:= ⨯ `Reduce[(x - 1) (x - 2) (x - 3) (x - 4) > 0, x]`
 Out[2]=

NumberLinePlot is a handy way to visualize these results:

 In[3]:= ⨯ `NumberLinePlot[x < 1 || 2 < x < 3 || x > 4, {x, -10, 10}]`
 Out[3]=

Many equations and formulas are available through natural-language input:

 In[1]:= X `quadratic equation`
 Out[1]=

QUICK REFERENCE: Polynomial Equations `»`

QUICK REFERENCE: Equation Solving `»`