Graph the Inequality Calculator

Inequality Graphing Calculator body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; background-color: #f8f9fa; color: #333; margin: 0; padding: 20px; } .calc-container { max-width: 800px; margin: 30px auto; background-color: #ffffff; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); padding: 30px; display: flex; flex-wrap: wrap; gap: 30px; } .calc-header { text-align: center; width: 100%; margin-bottom: 20px; color: #004a99; } .input-section { flex: 1; min-width: 250px; } .input-group { margin-bottom: 20px; } .input-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; } .input-group input[type="text"], .input-group input[type="number"] { width: calc(100% – 20px); padding: 12px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 1rem; transition: border-color 0.3s ease; } .input-group input[type="text"]:focus, .input-group input[type="number"]:focus { border-color: #004a99; outline: none; } .input-group select { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 1rem; background-color: white; } .button-group { text-align: center; width: 100%; margin-top: 30px; } .calculate-btn { background-color: #004a99; color: white; border: none; padding: 15px 30px; font-size: 1.1rem; font-weight: bold; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; } .calculate-btn:hover { background-color: #003366; transform: translateY(-2px); } .result-section { flex: 1; min-width: 250px; background-color: #e9ecef; padding: 25px; border-radius: 8px; text-align: center; } .result-section h3 { color: #004a99; margin-bottom: 15px; } #graphResult { font-size: 1.2rem; font-weight: bold; color: #28a745; white-space: pre-wrap; /* To preserve formatting for output */ word-break: break-all; /* To break long lines */ text-align: left; padding: 10px; border: 1px dashed #004a99; background-color: #f0f8ff; border-radius: 5px; min-height: 50px; display: flex; align-items: center; justify-content: center; } .article-section { width: 100%; margin-top: 40px; padding-top: 30px; border-top: 1px solid #eee; } .article-section h2 { text-align: center; color: #004a99; margin-bottom: 25px; } .article-content p, .article-content ul, .article-content ol { margin-bottom: 20px; color: #555; } .article-content strong { color: #004a99; } @media (max-width: 768px) { .calc-container { flex-direction: column; padding: 20px; } .input-section, .result-section { min-width: 100%; } }

Inequality Graphing Calculator

Input your linear inequality and we'll provide a textual representation of its solution set and how to graph it.

< (Less Than) > (Greater Than) ≤ (Less Than or Equal To) ≥ (Greater Than or Equal To) = (Equal To – for line graphing)
Below the line Above the line Left of the line Right of the line No shading (for equality)

Graphing Instructions

Enter inequality details to see graphing instructions.

Understanding Linear Inequalities and Their Graphs

Linear inequalities are fundamental concepts in algebra and are widely used to model real-world situations where relationships are not exact but rather defined by ranges or boundaries. Unlike linear equations, which represent a single line on a graph, linear inequalities represent a region on a coordinate plane.

What is a Linear Inequality?

A linear inequality in two variables (typically x and y) is an inequality that can be written in the form:

  • $Ax + By < C$
  • $Ax + By > C$
  • $Ax + By \le C$
  • $Ax + By \ge C$

where A, B, and C are constants, and A and B are not both zero. The symbols , ≤, and ≥ indicate the type of inequality.

How to Graph a Linear Inequality

Graphing a linear inequality involves two main steps:

  1. Graph the Boundary Line: First, treat the inequality as an equation (e.g., $Ax + By = C$) and graph this line.
    • If the inequality is strict (< or >), the line is dashed, indicating that points on the line are not part of the solution set.
    • If the inequality includes "or equal to" (≤ or ≥), the line is solid, indicating that points on the line are part of the solution set.
    A common way to graph the boundary line is by finding its x- and y-intercepts.
    • To find the x-intercept, set $y=0$ and solve for $x$.
    • To find the y-intercept, set $x=0$ and solve for $y$.
  2. Shade the Solution Region: After graphing the boundary line, you need to determine which side of the line represents the solution set. This is done by choosing a test point that is not on the line (the origin (0,0) is often the easiest, unless the line passes through it).
    • Substitute the coordinates of the test point into the original inequality.
    • If the inequality is true, shade the region that contains the test point.
    • If the inequality is false, shade the region that does not contain the test point.
    For inequalities in the form $Ax + By < C$ or $Ax + By \le C$, the shading is typically below the line if $B > 0$, or above the line if $B C$ or $Ax + By \ge C$, it's typically above the line if $B > 0$, or below the line if $B < 0$. For vertical lines ($By = C$), shading is left or right. For horizontal lines ($Ax = C$), shading is above or below.

Calculator Explanation

This calculator helps visualize these steps. You input the coefficients (A, B, C), the variables (x, y), the inequality sign, and the desired shading direction. It then provides a textual description of the boundary line and the region to be shaded, assisting in the graphing process.

Example Usage

Let's graph the inequality $2x + 3y \le 6$.

  • Variables: x, y
  • Coefficients: A=2, B=3
  • Constant: C=6
  • Inequality Sign: ≤ (Less Than or Equal To)

Steps:

  1. Boundary Line: Graph $2x + 3y = 6$.
    • If $x=0$, then $3y = 6$, so $y = 2$. The y-intercept is (0, 2).
    • If $y=0$, then $2x = 6$, so $x = 3$. The x-intercept is (3, 0).
    Since the inequality is ≤, the line will be solid. Draw a solid line through (0, 2) and (3, 0).
  2. Shading: Test the point (0,0). $2(0) + 3(0) \le 6$ $0 \le 6$ This is true. Therefore, shade the region containing (0,0), which is below the line.

The calculator output will guide you through these specific instructions based on your inputs.

function getElement(id) { return document.getElementById(id); } function calculateInequality() { var variableX = getElement("variableX").value || "x"; var variableY = getElement("variableY").value || "y"; var coeffA = parseFloat(getElement("coefficientA").value); var coeffB = parseFloat(getElement("coefficientB").value); var constantC = parseFloat(getElement("constantC").value); var inequalitySign = getElement("inequalitySign").value; var shadeRegion = getElement("shadeRegion").value; var resultDiv = getElement("graphResult"); resultDiv.style.color = "#28a745"; // Reset to success color // Input validation if (isNaN(coeffA) || isNaN(coeffB) || isNaN(constantC)) { resultDiv.innerHTML = "Error: Please enter valid numbers for coefficients and the constant."; resultDiv.style.color = "red"; return; } var instructions = ""; // Update labels dynamically getElement("coeffALabel").innerText = variableX; getElement("coeffBLabel").innerText = variableY; // — Determine Line Properties — var lineType = ""; var dashed = false; var solid = false; if (inequalitySign === "=") { lineType = "an equality"; dashed = false; solid = true; // Equality line is always solid shadeRegion = "none"; // No shading for equality } else if (inequalitySign === "") { lineType = "a strict inequality"; dashed = true; solid = false; } else { // = lineType = "an inclusive inequality"; dashed = false; solid = true; } instructions += `1. Graph the Boundary Line: ${coeffA}${variableX} + ${coeffB}${variableY} ${inequalitySign} ${constantC}\n`; instructions += ` – This represents ${lineType}.\n`; if (dashed) { instructions += ` – Use a DASHED line because the inequality is strict ().\n`; } else if (solid) { instructions += ` – Use a SOLID line because the inequality includes 'or equal to' (=) or is an equality.\n`; } // Calculate intercepts for graphing guidance var intercepts = []; if (coeffB !== 0) { // Not a vertical line var yInterceptVal = constantC / coeffB; intercepts.push(`y-intercept: (${variableX}=0, ${variableY}=${yInterceptVal.toFixed(2)})`); } if (coeffA !== 0) { // Not a horizontal line var xInterceptVal = constantC / coeffA; intercepts.push(`x-intercept: (${variableY}=0, ${variableX}=${xInterceptVal.toFixed(2)})`); } if (intercepts.length > 0) { instructions += ` – You can find points like: ${intercepts.join('; ')}.\n`; } else if (coeffA === 0 && coeffB === 0) { instructions += ` – This is not a standard linear equation.\n`; } else if (coeffA === 0) { // Horizontal line: By = C instructions += ` – This is a HORIZONTAL line at ${variableY} = ${constantC / coeffB}.\n`; } else if (coeffB === 0) { // Vertical line: Ax = C instructions += ` – This is a VERTICAL line at ${variableX} = ${constantC / coeffA}.\n`; } // — Determine Shading — instructions += `\n2. Shade the Solution Region:\n`; if (shadeRegion === "none" || inequalitySign === "=") { instructions += ` – Since this is an equality or you selected 'No shading', do NOT shade any region. The solution is just the line itself.\n`; } else { var testPointX = 0; var testPointY = 0; var testPointLabel = "(0,0)"; // Adjust test point if the line passes through the origin if (coeffA * testPointX + coeffB * testPointY === constantC) { testPointX = 1; // Choose a different point testPointY = 0; testPointLabel = "(1,0)"; if (coeffA * testPointX + coeffB * testPointY === constantC) { // Still on line? Choose another testPointX = 0; testPointY = 1; testPointLabel = "(0,1)"; } } var testResult = coeffA * testPointX + coeffB * testPointY; var isTrue = false; if (inequalitySign === "<") isTrue = testResult ") isTrue = testResult > constantC; else if (inequalitySign === "<=") isTrue = testResult =") isTrue = testResult >= constantC; var regionToShade = ""; if (isTrue) { regionToShade = "contains the test point"; } else { regionToShade = "does NOT contain the test point"; } instructions += ` – Use the test point ${testPointLabel}.\n`; instructions += ` – Substitute into the inequality: ${coeffA}(${testPointX}) + ${coeffB}(${testPointY}) ${inequalitySign} ${constantC}\n`; instructions += ` – Calculate: ${testResult} ${inequalitySign} ${constantC}. This statement is ${isTrue ? 'TRUE' : 'FALSE'}.\n`; instructions += ` – Shade the region that ${regionToShade} (${testPointLabel}).\n`; // Provide specific direction based on user input and calculation if (shadeRegion === "below" && !isTrue) { instructions += ` – For example, shade BELOW the line.\n`; } else if (shadeRegion === "above" && !isTrue) { instructions += ` – For example, shade ABOVE the line.\n`; } else if (shadeRegion === "left" && !isTrue) { instructions += ` – For example, shade to the LEFT of the line.\n`; } else if (shadeRegion === "right" && !isTrue) { instructions += ` – For example, shade to the RIGHT of the line.\n`; } else if (shadeRegion === "below" && isTrue) { instructions += ` – For example, shade ABOVE the line (opposite of below).\n`; } else if (shadeRegion === "above" && isTrue) { instructions += ` – For example, shade BELOW the line (opposite of above).\n`; } else if (shadeRegion === "left" && isTrue) { instructions += ` – For example, shade to the RIGHT of the line (opposite of left).\n`; } else if (shadeRegion === "right" && isTrue) { instructions += ` – For example, shade to the LEFT of the line (opposite of right).\n`; } else { // Fallback if shadeRegion doesn't perfectly align with test point logic instructions += ` – Ensure your shading matches the direction indicated by the inequality and the boundary line's orientation.\n`; } } resultDiv.innerText = instructions; }

Leave a Comment