Calculator That Shows Work

Step-by-Step Linear Equation Solver (ax + b = c)

Enter the coefficients and constants for your linear equation in the form ax + b = c to see the solution for x and the detailed steps involved.

Result:

Steps to Solve:

Understanding Linear Equations and How to Solve Them

A linear equation is an algebraic equation in which each term has an exponent of one and the graphing of the equation results in a straight line. The most common form for a single-variable linear equation is ax + b = c, where:

  • x is the variable you want to solve for.
  • a is the coefficient of x (a number multiplied by x).
  • b is a constant term on the same side as x.
  • c is a constant term on the opposite side of x.

The Goal: Isolate the Variable

The primary goal when solving any linear equation is to isolate the variable (x) on one side of the equation. This means getting x by itself, with a coefficient of 1. To achieve this, we use inverse operations.

Step-by-Step Solving Process:

  1. Eliminate the constant term (b) from the side with x: To do this, you perform the inverse operation of what's currently applied to b. If b is being added, subtract b from both sides of the equation. If b is being subtracted, add b to both sides. This maintains the equality of the equation.
  2. Eliminate the coefficient (a) from x: Once ax is isolated, you need to get rid of the coefficient a. Since a is multiplying x, the inverse operation is division. Divide both sides of the equation by a.
  3. The result: After these steps, you will have x isolated on one side, and its value on the other.

Example Walkthrough:

Let's take the equation 2x + 5 = 15, which is the default example in our calculator:

  1. Original Equation: 2x + 5 = 15
  2. Step 1: Subtract 5 from both sides to move the constant term b:
    • 2x + 5 - 5 = 15 - 5
    • 2x = 10
  3. Step 2: Divide both sides by 2 to isolate x:
    • 2x / 2 = 10 / 2
    • x = 5

So, the solution for x is 5.

This calculator automates these steps, allowing you to quickly solve various linear equations and understand the process behind the solution.

.calculator-container { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 8px; padding: 20px; max-width: 700px; margin: 20px auto; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); } .calculator-container h2 { color: #333; text-align: center; margin-bottom: 20px; } .calculator-content p { margin-bottom: 15px; line-height: 1.6; color: #555; } .input-group { margin-bottom: 15px; } .input-group label { display: block; margin-bottom: 5px; color: #333; font-weight: bold; } .input-group input[type="number"] { width: calc(100% – 22px); padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 16px; } button { background-color: #007bff; color: white; padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; display: block; width: 100%; margin-top: 20px; transition: background-color 0.3s ease; } button:hover { background-color: #0056b3; } .result-area { margin-top: 25px; padding: 15px; background-color: #e9f7ef; border: 1px solid #d4edda; border-radius: 5px; } .result-area h3 { color: #28a745; margin-top: 0; margin-bottom: 10px; border-bottom: 1px solid #d4edda; padding-bottom: 5px; } #result { font-size: 1.2em; font-weight: bold; color: #007bff; margin-bottom: 15px; } #workSteps { font-size: 0.95em; color: #333; white-space: pre-wrap; /* Ensures line breaks are respected */ background-color: #f0f8ff; padding: 10px; border-radius: 4px; border: 1px dashed #a7d9ff; } .calculator-article { margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee; } .calculator-article h3 { color: #333; margin-bottom: 15px; } .calculator-article p, .calculator-article ul, .calculator-article ol { color: #555; line-height: 1.6; margin-bottom: 10px; } .calculator-article ul, .calculator-article ol { margin-left: 20px; } .calculator-article li { margin-bottom: 5px; } function calculateEquation() { var a = parseFloat(document.getElementById("coefficientA").value); var b = parseFloat(document.getElementById("constantB").value); var c = parseFloat(document.getElementById("constantC").value); var resultDiv = document.getElementById("result"); var workStepsDiv = document.getElementById("workSteps"); resultDiv.innerHTML = ""; workStepsDiv.innerHTML = ""; if (isNaN(a) || isNaN(b) || isNaN(c)) { resultDiv.innerHTML = "Please enter valid numbers for all fields."; return; } var steps = []; var currentEquation = a + "x + " + b + " = " + c; steps.push("Original Equation: " + currentEquation); // Step 1: Subtract 'b' from both sides var cMinusB = c – b; steps.push("Step 1: Subtract " + b + " from both sides."); steps.push(a + "x + " + b + " – " + b + " = " + c + " – " + b); steps.push(a + "x = " + cMinusB); // Step 2: Divide by 'a' if (a === 0) { if (cMinusB === 0) { resultDiv.innerHTML = "Infinite solutions (0x = 0)."; workStepsDiv.innerHTML = steps.join(""); } else { resultDiv.innerHTML = "No solution (0x = " + cMinusB + ")."; workStepsDiv.innerHTML = steps.join(""); } return; } var x = cMinusB / a; steps.push("Step 2: Divide both sides by " + a + "."); steps.push(a + "x / " + a + " = " + cMinusB + " / " + a); steps.push("x = " + x); resultDiv.innerHTML = "The value of x is: " + x.toFixed(4) + ""; workStepsDiv.innerHTML = steps.join(""); }

Leave a Comment