Calculator for Inequalities and Graphing

Linear Inequality & Graphing Calculator

Visualize and solve inequalities in the form y [sign] mx + b

">Greater Than ( > ) <option value="Less Than ( < ) =">Greater Than or Equal ( ≥ ) <option value="Less Than or Equal ( ≤ )

Inequality Analysis

Shaded: Solution Set Line: Boundary

How to Use the Inequality Grapher

This calculator helps you visualize linear inequalities in two variables. By entering the slope and the y-intercept, you can see the boundary line and the shaded region representing all possible solutions.

Key Rules for Graphing Inequalities

  • Solid vs. Dashed Lines: Use a solid line for ≤ or ≥ (indicating points on the line are included). Use a dashed line for < or >.
  • Shading: If the sign is > or ≥, shade above the boundary line. If it is < or ≤, shade below the boundary line.
  • Slope (m): This determines the "steepness" of the line. A positive slope goes up from left to right; a negative slope goes down.
  • Y-Intercept (b): This is the point where the line crosses the vertical Y-axis.

Realistic Example

Suppose you have the inequality y ≥ 2x – 3:

  1. Slope (m): 2 (The line rises 2 units for every 1 unit it moves right).
  2. Y-Intercept (b): -3 (The line starts at -3 on the Y-axis).
  3. Boundary: Because it is "Greater Than or Equal To", we draw a solid line.
  4. Solution: We shade the area above the line.
function calculateInequality() { var m = parseFloat(document.getElementById('slopeInput').value); var b = parseFloat(document.getElementById('interceptInput').value); var sign = document.getElementById('signInput').value; var resultArea = document.getElementById('resultArea'); var inequalityText = document.getElementById('inequalityText'); var interceptInfo = document.getElementById('interceptInfo'); var svg = document.getElementById('graphSvg'); if (isNaN(m) || isNaN(b)) { alert("Please enter valid numbers for slope and intercept."); return; } resultArea.style.display = 'block'; inequalityText.innerText = "y " + sign + " " + m + "x + " + b; var xIntercept = m !== 0 ? (-b / m).toFixed(2) : "None"; interceptInfo.innerHTML = "Y-Intercept: (0, " + b + ")X-Intercept: (" + xIntercept + ", 0)"; // Drawing Logic var size = 400; var padding = 40; var scale = (size – 2 * padding) / 20; // 20 units total range (-10 to 10) function toSvgX(x) { return (x + 10) * scale + padding; } function toSvgY(y) { return (10 – y) * scale + padding; } var content = "; // Grid and Axes content += "; // X-axis content += "; // Y-axis // Boundary line points var x1 = -10; var y1 = m * x1 + b; var x2 = 10; var y2 = m * x2 + b; // Shading path var dashArray = (sign === ">" || sign === "" || sign === ">=") ? 1 : -1; // To shade correctly, we need a polygon that covers the top or bottom of the SVG var shadePath = "; if (fillDirection === 1) { // Shade above shadePath = "M " + toSvgX(x1) + " " + toSvgY(y1) + " L " + toSvgX(x2) + " " + toSvgY(y2) + " L " + toSvgX(x2) + " " + padding + " L " + toSvgX(x1) + " " + padding + " Z"; } else { // Shade below shadePath = "M " + toSvgX(x1) + " " + toSvgY(y1) + " L " + toSvgX(x2) + " " + toSvgY(y2) + " L " + toSvgX(x2) + " " + (size-padding) + " L " + toSvgX(x1) + " " + (size-padding) + " Z"; } content += "; content += "; // Add labels content += 'x'; content += 'y'; svg.innerHTML = content; } // Initial calculation window.onload = function() { calculateInequality(); };

Leave a Comment