How do you solve for x?
Type an equation in x, such as 2x + 7 = 19. The page finds every real value of x that makes it true and tests each one in the equation before it shows it.
- Solutions
- x = 6
Solving 2x + 7 = 19 gives x = 6.
- Number of real solutions
- 1
Solutions: x = 6. Solving 2x + 7 = 19 gives x = 6.
How to calculate
Finds every real x that makes an equation true, and checks each one.
Worked examples
Each example is checked against the calculator on every build.
- Equation 2x + 7 = 19 gives Solutions x = 6, Number of real solutions 1.Source: OpenStax College Algebra 2e, 2.2, Ex. 1. https://openstax.org/books/college-algebra-2e/pages/2-2-linear-equations-in-one-variable
- Equation 7/(2x) - 5/(3x) = 22/3 gives Solutions x = 1/4, As decimals x ≈ 0.25, Number of real solutions 1.
How it works
The solve for x calculator finds every real number that makes the two sides of your equation equal. It works in three steps, and shows an answer only when all three agree.
- Algebra. Everything is moved to one side, left − right = 0, and every fraction with the letter in its denominator is multiplied out, so the algebra sees one expression with no such fractions. A computer algebra system (nerdamer, open source) solves that. The algebra runs after you start typing, in the background. If it finds no formula (eˣ = x + 3), the page goes on with the scan alone; if a root it gives fails its own check, the page says "No verified answer".
- Check each root in the equation as typed. A root from the algebra counts only if both sides are real numbers there and either differ by exactly 0 (for an exact root) or change sign across it: left − right has opposite signs at r − h and r + h, with h = 10⁻⁷ × max(1, |r|), and differs by at most 10⁻⁸ × max(1, s) at r, where s is the sum of the sizes of the terms of left − right. A root where a side is not a real number (a denominator of 0, the square root or logarithm of a negative number) is excluded. A root that fails the check is dropped: x = 0 for x² = 2 × 10⁻²⁰ (left − right is −2 × 10⁻²⁰ there, and positive on both sides), and the rounded roots next to 0 for eˣ = x + 1.
- Scan for solutions the algebra missed. The page evaluates left − right at every 0.005 from −10 to 10, then at 120 points per power of ten out to −10¹² and 10¹², and, next to any place where the sides stop being real numbers, at points halving the distance to that edge down to the last digit a computer number holds.
- A sign change is narrowed down by halving 1,100 times; if both sides agree there, that is a solution.
- A point where left − right is exactly 0, next to a nonzero value, is a solution (√(x − 1/3) = 0 at x = 1/3, the edge of its domain).
- Where |left − right| has a local minimum without a sign change (its two neighbouring values both above 10⁻¹⁰⁰ in size, so a function that only fades towards 0, such as e^(2x) far to the left, does not count), the page searches for the lowest point. If left − right crosses 0 there by more than 10⁻¹² × s, there are two solutions, found by halving on each side (x² = 2 × 10⁻²⁰ gives ±1.414213562 × 10⁻¹⁰). If it only reaches within 10⁻¹² × max(1, s) of 0 and the algebra gave no solution there, the page cannot tell a double root from a near miss and says "No verified answer".
- If left − right is 0 to within 10⁻¹⁴ × s at two scan points in a row, the solutions fill an interval (|x| = x for every x ≥ 0), or the equation is an identity (x + 1 = x + 1); the page says "The solutions fill an interval." and lists none.
- If left − right is infinite just past the edge of the domain with the other sign from its value at the edge, a solution lies closer to that edge than a computer number can hold (ln(x) = −1000 at x = e^(−1000)); the page says "No verified answer: a possible solution could not be confirmed."
- A solution the scan finds and the algebra did not give is added as a decimal. A scan solution counts as one the algebra gave when an algebra root lies in the interval where the scan found it.
- One entry per solution. A decimal root (a rounded root from the algebra, or a root from the scan) gives way to an exact root within 10⁻⁷ × max(1, |x|) of it: e^(2x) − 3eˣ + 2 = 0 gives x = 0 and x ≈ 0.6931471806, not the rounded 1.19 × 10⁻¹⁷ the algebra also returns. Two roots within 10⁻¹² × max(1, |x|) of each other count as one. A rounded root from the algebra that passes step 2 is written from its own value: x = 1.0000000005 gives x ≈ 1.000000001.
The same solve model runs the algebra calculator and the equation solver.
What you can type
- An equation with one = sign, such as 2x + 7 = 19. With no = sign, the page solves expression = 0.
- One variable. Use one lowercase letter as the unknown: x, t, y, and so on. The page solves for whichever letter you use. Two different letters (such as x and y) give no answer. The letter e is Euler’s number, and pi (or π) is π.
- Numbers can have decimals (2.5) and powers of ten (1e-3).
- Operations: + − * / and ^ for powers. Brackets group. A number or bracket next to a letter multiplies: 2x, 3(x + 1).
- Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), the inverse trig functions asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh and tanh.
- Not allowed: sin, cos, tan, sec, csc or cot of the unknown. Such equations usually have infinitely many solutions, so the page gives no answer. The same functions of a number, such as sin(1), are fine.
- Only real numbers count. A fractional power with an odd denominator is the real root: x^(1/3) at x = −8 is −2.
How answers are written
- Solutions lists each different real solution once (a double root once), in increasing order, separated by commas:
x = -3, x = -3/4. The letter is the one you used. - A solution the algebra gives exactly is written with =, in the syntax you type: fractions a/b, sqrt(u), powers with ^, with the terms of each solution in the order the algebra gives them:
x = 3/2 - sqrt(29)/2,x = sqrt(29)/2 + 3/2. - A solution with no exact form found is written with ≈ and 10 significant figures:
x ≈ 1.167303978. The page also uses the decimal when the algebra returns a rounded number (a fraction whose denominator, after removing factors 2 and 5, is over 1,000,000, or whose numerator times that denominator is over 10¹²), because such a fraction is not exact. - As decimals repeats every solution with ≈ and 10 significant figures. It appears when at least one exact solution is not a plain whole or decimal number.
- Number of real solutions counts the different real solutions.
- When there is none, Solutions reads no real solution and the count is 0: x + 1 = x + 2 and x² + x + 2 = 0 have none.
What gets no answer
- Equations with sin, cos, tan, sec, csc or cot of the unknown.
- An equation whose solutions fill an interval, or an identity.
- An equation that takes over 3 seconds.
- A root from the algebra that the check rejects is dropped, not shown. A possible solution that the scan finds but cannot confirm (a dip of left − right towards 0 with no sign change, where the algebra gave nothing), or one too close to the edge of the domain to compute, gives "No verified answer".
- Solutions beyond −10¹² or 10¹² are listed only when the algebra finds them.
Assumptions
- Only real solutions; complex solutions are left out.
- Angles are in radians and log is the natural logarithm.
Worked examples by hand
2x + 7 = 19 (OpenStax College Algebra 2e, section 2.2, Example 1). Subtract 7 from both sides: 2x = 12. Divide both sides by 2: x = 6. Check: 2 × 6 + 7 = 19.
7/(2x) − 5/(3x) = 22/3 (OpenStax College Algebra 2e, section 2.2, Example 3). x = 0 is excluded. Multiply both sides by 6x: 21 − 10 = 44x, so 11 = 44x and x = 1/4 = 0.25. Check: 7/(1/2) − 5/(3/4) = 14 − 20/3 = 22/3.
x² + x − 6 = 0 (OpenStax College Algebra 2e, section 2.5, Example 1). Factor: (x + 3)(x − 2) = 0, so x = −3 or x = 2.
Other questions people ask
What does it mean to solve for x?
To find every number that makes the equation true when it takes the place of x. For 2x + 7 = 19, only x = 6 works: 2 × 6 + 7 = 19. An equation can have one solution, several (x² + x − 6 = 0 has x = −3 and x = 2), none, or, for an identity such as 2(x + 1) = 2x + 2, every number; for that last kind the page says the solutions fill an interval.
How do I isolate x by hand?
Undo each operation on x in reverse order, doing the same to both sides. For 2x + 7 = 19, subtract 7 from both sides (2x = 12), then divide both sides by 2 (x = 6). For an equation with x in several places, first collect the x terms on one side and the numbers on the other.
What if x is in a denominator?
Multiply both sides by the denominators to clear them, solve, and then check that no solution makes a denominator 0. For 7/(2x) − 5/(3x) = 22/3, multiplying by 6x gives 21 − 10 = 44x, so x = 1/4. The page does the same, and drops any value that makes a denominator 0.
What if the equation has x squared?
A quadratic equation can have two real solutions, one, or none. The page lists the real ones in increasing order: x² + x − 6 = 0 gives x = −3, x = 2. When the solutions involve a square root, it shows them exactly and as decimals.
Can I solve for a different letter?
Yes. Type the equation in any one lowercase letter, such as 5y − 3 = 12, and the page solves for y. An equation with two different letters, such as x + y = 10, has no single answer and gives none here. The letter e is Euler’s number, not an unknown.
Why does the page say "No verified answer"?
Each value of x is tested before it is shown. If a value fails the test, if the scan finds a possible solution it cannot confirm, or if the work takes over 3 seconds, the page says "No verified answer" instead.