Inequality Calculator Graph

Linear Inequality Solver

This calculator helps you solve linear inequalities of the form ax + b [operator] c and provides a description of how to represent the solution graphically on a number line.

">> (Greater Than) <option value="< (Less Than) =" selected>≥ (Greater Than or Equal To) <option value="≤ (Less Than or Equal To)
function calculateInequality() { var a = parseFloat(document.getElementById("coeffA").value); var b = parseFloat(document.getElementById("coeffB").value); var c = parseFloat(document.getElementById("constantC").value); var operator = document.getElementById("operator").value; var resultDiv = document.getElementById("result"); // Input validation if (isNaN(a) || isNaN(b) || isNaN(c)) { resultDiv.innerHTML = "Please enter valid numbers for all coefficients and constants."; return; } // Rearrange the inequality to the form ax [operator] (c – b) var rhs = c – b; var solutionText = ""; var graphDescription = ""; var originalInequality = a + "x + " + b + " " + operator + " " + c; if (a === 0) { // Special case: 0x + b [operator] c simplifies to b [operator] c var isTrue = false; switch (operator) { case ">": isTrue = (b > c); break; case "<": isTrue = (b =": isTrue = (b >= c); break; case "<=": isTrue = (b <= c); break; } if (isTrue) { solutionText = "All real numbers"; graphDescription = "The inequality is true for any value of x. On a number line, the entire line is shaded."; } else { solutionText = "No solution"; graphDescription = "The inequality is false for any value of x. On a number line, there are no points that satisfy the inequality."; } } else { var solutionValue = rhs / a; var finalOperator = operator; // If 'a' is negative, reverse the inequality operator if (a ": finalOperator = "<"; break; case ""; break; case ">=": finalOperator = "<="; break; case "="; break; } } solutionText = "x " + finalOperator + " " + solutionValue.toFixed(4); // Format to 4 decimal places for clarity // Generate graph description for a number line var circleType = (finalOperator === ">" || finalOperator === "" || finalOperator === ">=") { direction = "shade to the right"; } else { // < or <= direction = "shade to the left"; } graphDescription = "On a number line, place " + circleType + " at " + solutionValue.toFixed(4) + " and " + direction + "."; } resultDiv.innerHTML = `

Solution:

For the inequality ${originalInequality}: ${solutionText}

Graphical Interpretation (Number Line):

${graphDescription} `; } .calculator-container { background-color: #f9f9f9; border: 1px solid #ddd; padding: 20px; border-radius: 8px; max-width: 650px; margin: 20px auto; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; box-shadow: 0 4px 8px rgba(0,0,0,0.1); } .calculator-container h2 { color: #2c3e50; text-align: center; margin-bottom: 20px; font-size: 1.8em; } .calculator-container p { margin-bottom: 10px; line-height: 1.6; color: #34495e; } .calc-input-group { margin-bottom: 15px; } .calc-input-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #34495e; font-size: 0.95em; } .calc-input-group input[type="number"], .calc-input-group select { width: calc(100% – 22px); padding: 10px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 16px; color: #333; } .calc-input-group select { width: 100%; /* Adjust for select element */ appearance: none; /* Remove default arrow */ background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007bff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.2-5.4H18.6c-5%200-9.3%201.8-13.2%205.4A17.6%2017.6%200%200%200%200%2082.6c0%204.8%201.8%209.3%205.4%2013.2l128%20128c3.9%203.9%208.4%205.4%2013.2%205.4s9.3-1.8%2013.2-5.4l128-128c3.9-3.9%205.4-8.4%205.4-13.2%200-4.8-1.8-9.3-5.4-13.2z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 30px; } button { background-color: #007bff; color: white; padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1.1em; width: 100%; margin-top: 10px; transition: background-color 0.3s ease; } button:hover { background-color: #0056b3; } .calc-result { margin-top: 25px; padding: 15px 20px; background-color: #e8f5e9; /* Light green */ border: 1px solid #c8e6c9; /* Green border */ border-radius: 5px; color: #2e7d32; /* Dark green text */ } .calc-result h3 { color: #1b5e20; /* Even darker green */ margin-top: 0; margin-bottom: 10px; font-size: 1.4em; } .calc-result p { margin-bottom: 5px; color: #388e3c; } .calc-result .solution-output { font-size: 1.3em; font-weight: bold; color: #0056b3; /* Blue for the solution */ background-color: #e3f2fd; padding: 8px 12px; border-radius: 4px; display: inline-block; margin-top: 5px; margin-bottom: 10px; } .calc-result .error { color: #d32f2f; /* Red for errors */ font-weight: bold; background-color: #ffebee; padding: 8px 12px; border-radius: 4px; } code { background-color: #eceff1; padding: 2px 4px; border-radius: 3px; font-family: 'Courier New', Courier, monospace; color: #455a64; }

Understanding and Graphing Linear Inequalities

Linear inequalities are fundamental concepts in algebra that extend the idea of linear equations. While a linear equation like ax + b = c has a single solution (or no solution, or infinitely many solutions in special cases), a linear inequality typically has a range of solutions, which can be represented as an interval on a number line.

What is a Linear Inequality?

A linear inequality is a mathematical statement that compares two expressions using an inequality symbol. The general form is ax + b [operator] c, where:

  • a and b are coefficients (real numbers), with a not equal to zero for a standard linear inequality.
  • x is the variable.
  • c is a constant (real number).
  • [operator] can be one of four symbols:
    • > (greater than)
    • < (less than)
    • (greater than or equal to)
    • (less than or equal to)

Unlike equations, which seek a specific value that makes the statement true, inequalities seek a set of values (an interval) that satisfy the condition.

How to Solve Linear Inequalities

Solving linear inequalities is very similar to solving linear equations, with one crucial difference:

  1. Isolate the variable term: Use addition or subtraction to move all constant terms to one side of the inequality and terms with the variable to the other. For example, in ax + b > c, subtract b from both sides to get ax > c - b.
  2. Isolate the variable: Divide or multiply both sides by the coefficient of the variable (a in our example).
  3. The Critical Rule: If you multiply or divide both sides of an inequality by a negative number, you must reverse the direction of the inequality sign. For example, if you have -2x > 6 and divide by -2, it becomes x < -3.

Special Cases:

  • If a = 0: The inequality simplifies to b [operator] c.
    • If this resulting statement is true (e.g., 5 > 2), then the solution is "All real numbers" (any value of x will satisfy it).
    • If this resulting statement is false (e.g., 5 < 2), then there is "No solution" (no value of x will satisfy it).

Graphing Linear Inequalities on a Number Line

The solution to a one-variable linear inequality is an interval, which can be visually represented on a number line. Here's how:

  1. Find the Critical Point: This is the value of x that makes the inequality an equality (e.g., if x > 5, the critical point is 5).
  2. Determine the Type of Circle:
    • Use an open circle (○) at the critical point if the inequality is strict (> or <). This indicates that the critical point itself is NOT part of the solution.
    • Use a closed circle (●) at the critical point if the inequality is non-strict ( or ). This indicates that the critical point IS part of the solution.
  3. Determine the Direction of Shading:
    • If the inequality is > or , shade the number line to the right of the critical point.
    • If the inequality is < or , shade the number line to the left of the critical point.

How to Use the Linear Inequality Solver

Our calculator simplifies the process of solving and understanding linear inequalities:

  1. Coefficient 'a': Enter the number multiplying x.
  2. Coefficient 'b': Enter the constant term on the left side of the inequality.
  3. Inequality Operator: Select the appropriate comparison symbol (>, <, , or ).
  4. Constant 'c': Enter the constant term on the right side of the inequality.
  5. Click "Solve Inequality" to see the solution set for x and a description of its graphical representation on a number line.

Examples:

Example 1: Simple Greater Than

Inequality: 2x + 3 > 11

  • Input: a=2, b=3, operator=>, c=11
  • Calculation:
    1. 2x > 11 - 3
    2. 2x > 8
    3. x > 4 (divide by positive 2, so operator doesn't change)
  • Solution: x > 4
  • Graph: An open circle at 4, shaded to the right.

Example 2: Less Than or Equal To with Negative Coefficient

Inequality: -3x + 5 ≤ 14

  • Input: a=-3, b=5, operator=≤, c=14
  • Calculation:
    1. -3x ≤ 14 - 5
    2. -3x ≤ 9
    3. x ≥ -3 (divide by negative 3, so operator reverses from ≤ to ≥)
  • Solution: x ≥ -3
  • Graph: A closed circle at -3, shaded to the right.

Example 3: No Solution Case

Inequality: 0x + 7 < 2

  • Input: a=0, b=7, operator=<, c=2
  • Calculation:
    1. Simplifies to 7 < 2
    2. This statement is false.
  • Solution: No solution
  • Graph: No points on the number line satisfy the inequality.

Example 4: All Real Numbers Case

Inequality: 0x + 1 ≥ 1

  • Input: a=0, b=1, operator=≥, c=1
  • Calculation:
    1. Simplifies to 1 ≥ 1
    2. This statement is true.
  • Solution: All real numbers
  • Graph: The entire number line is shaded.

Leave a Comment