##### Related Content

Programmers and Teachers:

# Solve for x Calculator

## Lesson on Solving for Variables

#### Lesson Contents

### How to Solve for a Variable

**In algebra, we solve for a variable within an equation by isolating the variable.** However, sometimes we cannot isolate the variable because it has multiple unlike terms of the same variable (such as x^{2} + 2x). These cases require special techniques to solve. Also, there will sometimes be no real solution for the variable.

To isolate a variable, use the reverse order of operations to move every term that does not contain the variable to the other side of the equation. Continue performing algebraic manipulation until only the variable itself is present on its side of the equation.

### When the Variable can't be Isolated

**If there are multiple unlike terms containing the applicable variable, we may not be able to algebraically manipulate the equation enough for full variable isolation.** An example is trying to solve for *x* in the polynomial equation 0 = 2x^{3} + x^{2} – 6x + 5.

We may employ special techniques in these cases. Commonly used techniques for solving polynomials include factoring and the quadratic formula. Factoring can be used on a polynomial of any degree, while the quadratic formula can only be used on 2nd-degree (quadratic) polynomials.

Sometimes we come across an equation that cannot be solved by hand. This can be due to it not having any real, whole number, fractional, or rational solutions. In fact, statistically, these equations are more likely to occur in the real-world than equations that can be solved by hand.

These cases are where numerical methods must be employed. Numerical methods are leveraged by computers to perform many iterations of an explicit technique to converge on a very accurate approximate solution. The calculator on this page employs numerical methods when there is no exact algebraic solution.

## How the Calculator Works

The calculator on this page is written in the programming language JavaScript (JS) and powered by a JS native computer algebra system (CAS). Your device’s internet browser runs the calculator entirely in its built-in JS engine, providing near-instant answers at the click of the calculate button.

When you click the calculate button, your inputted equation or expression is filtered into the CAS which then solves for *x*. The CAS first attempts to solve symbolically. It treats each letter and number as a symbol and isolates the variable being solved for. When it cannot attain a solution symbolically, it then attempts to solve using numerical methods.

Once finished solving, the result is converted to LaTeX (a math rendering language) and displayed on the calculator as the answer. Sometimes the inputted expression or equation has no solution or causes an error during calculations. When this happens, an error notice is displayed in the answer area.