A linear inequality is a mathematical statement that relates two expressions using an inequality symbol. Unlike linear equations, which have a specific numerical solution, linear inequalities often result in a range or "set" of values that make the statement true.
The standard form solved by this calculator is ax + b < c (or using other symbols like ≤, >, or ≥). Solving these is very similar to solving regular equations, with one crucial rule: If you multiply or divide both sides by a negative number, you must flip the inequality sign.
How to Use This Calculator
Coefficient (a): The number multiplied by x.
Constant (b): The number added to or subtracted from the x term on the left side.
Operator: Choose whether the left side is less than, greater than, or equal to the right side.
Result (c): The constant value on the right side of the inequality.
Step-by-Step Example
Example: Solve -2x + 5 > 11
Subtract 5 from both sides: -2x > 6
Divide by -2. Since -2 is negative, we flip the sign: x < (6 / -2)
Final Result: x < -3
Interval Notation: (-∞, -3)
Common Inequality Symbols
• < : Less than (open circle on a graph)
• ≤ : Less than or equal to (closed circle)
• > : Greater than (open circle)
• ≥ : Greater than or equal to (closed circle)
function solveInequality() {
var a = parseFloat(document.getElementById('coeff_a').value);
var b = parseFloat(document.getElementById('const_b').value);
var op = document.getElementById('operator').value;
var c = parseFloat(document.getElementById('const_c').value);
var resultArea = document.getElementById('result_area');
var solutionText = document.getElementById('solution_text');
var stepsArea = document.getElementById('steps_area');
var intervalArea = document.getElementById('interval_notation');
if (isNaN(a) || isNaN(b) || isNaN(c)) {
alert("Please enter valid numbers for all fields.");
return;
}
resultArea.style.display = "block";
// Case where a is 0 (not a linear inequality in x)
if (a === 0) {
var isTrue = false;
if (op === "<") isTrue = b < c;
else if (op === "<=") isTrue = b ") isTrue = b > c;
else if (op === ">=") isTrue = b >= c;
if (isTrue) {
solutionText.innerHTML = "All Real Numbers";
stepsArea.innerHTML = "Step 1: 0x + " + b + " " + op + " " + c + "Step 2: " + b + " " + op + " " + c + " is always TRUE.Result: x can be any value.";
intervalArea.innerHTML = "Interval: (-∞, ∞)";
} else {
solutionText.innerHTML = "No Solution";
stepsArea.innerHTML = "Step 1: 0x + " + b + " " + op + " " + c + "Step 2: " + b + " " + op + " " + c + " is always FALSE.Result: No value of x satisfies this.";
intervalArea.innerHTML = "Interval: ∅";
}
return;
}
// Step 1: Subtract b
var rhs = c – b;
var step1 = a + "x " + op + " " + rhs + " (Subtracted " + b + " from both sides)";
// Step 2: Divide by a
var finalVal = rhs / a;
finalVal = Math.round(finalVal * 1000) / 1000; // Round to 3 decimals
var finalOp = op;
var flipMsg = "";
if (a < 0) {
flipMsg = "Note: Inequality sign flipped because we divided by a negative number (" + a + ").";
if (op === "";
else if (op === "=";
else if (op === ">") finalOp = "=") finalOp = "<=";
}
solutionText.innerHTML = "x " + finalOp + " " + finalVal;
stepsArea.innerHTML = "Step 1: " + step1 + "Step 2: x " + finalOp + " " + rhs + " / " + a + flipMsg;
// Interval Notation
var interval = "";
if (finalOp === "<") interval = "(-∞, " + finalVal + ")";
else if (finalOp === "") interval = "(" + finalVal + ", ∞)";
else if (finalOp === ">=") interval = "[" + finalVal + ", ∞)";
intervalArea.innerHTML = "Interval Notation: " + interval;
}