Linear: f(x) = mx + b
Quadratic: f(x) = ax² + bx + c
Square Root: f(x) = √(ax + b) + c
Rational: f(x) = 1 / (ax + b) + c
Analysis Results:
Domain (Input x values):
Range (Output y values):
Understanding Domain and Range in Graphs
In mathematics, understanding the boundaries of a function is crucial for graphing and calculus. This calculator helps you identify the Domain (the set of all possible input values, usually x) and the Range (the set of all possible output values, usually y or f(x)).
Key Definitions
Domain: The horizontal span of the graph. It answers the question: "What x-values can I plug into this function without breaking math rules (like dividing by zero or taking the square root of a negative number)?"
Range: The vertical span of the graph. It answers the question: "What y-values can this function actually produce?"
Common Function Behaviors
1. Linear Functions (mx + b): Unless restricted, linear functions extend forever in both directions.
Domain: (-∞, ∞) | Range: (-∞, ∞)
2. Quadratic Functions (ax² + bx + c): These form parabolas. They go horizontally forever, but they have a "peak" or "valley" called the vertex.
Example: f(x) = x² has a Range of [0, ∞) because it never goes below zero.
3. Square Root Functions: You cannot take the square root of a negative number in real-number math. This restricts the domain starting from where the inside of the root is zero.
How to use Interval Notation
Our calculator uses standard interval notation:
( ) Parentheses: Indicate the value is NOT included (used for infinity or open circles).
[ ] Brackets: Indicate the value IS included (closed circles or vertex points).
∪ Union: Used to join two separate sets of numbers.
function updateInputs() {
var type = document.getElementById("functionType").value;
var labelA = document.getElementById("label_a");
var labelB = document.getElementById("label_b");
var labelC = document.getElementById("label_c");
var containerC = document.getElementById("input_c_container");
if (type === "linear") {
labelA.innerText = "m (Slope):";
labelB.innerText = "b (Intercept):";
containerC.style.display = "none";
} else if (type === "quadratic") {
labelA.innerText = "a (Coefficient of x²):";
labelB.innerText = "b (Coefficient of x):";
labelC.innerText = "c (Constant):";
containerC.style.display = "block";
} else if (type === "sqrt") {
labelA.innerText = "a (Inside Coefficient):";
labelB.innerText = "b (Inside Constant):";
labelC.innerText = "c (Vertical Shift):";
containerC.style.display = "block";
} else if (type === "rational") {
labelA.innerText = "a (Denominator Coeff):";
labelB.innerText = "b (Denominator Const):";
labelC.innerText = "c (Vertical Shift):";
containerC.style.display = "block";
}
}
function calculateDomainRange() {
var type = document.getElementById("functionType").value;
var a = parseFloat(document.getElementById("val_a").value);
var b = parseFloat(document.getElementById("val_b").value);
var c = parseFloat(document.getElementById("val_c").value);
var domainText = "";
var rangeText = "";
if (isNaN(a) || isNaN(b)) {
alert("Please enter valid numbers for the coefficients.");
return;
}
if (type === "linear") {
if (a === 0) {
domainText = "(-∞, ∞)";
rangeText = "[" + b + ", " + b + "]";
} else {
domainText = "(-∞, ∞)";
rangeText = "(-∞, ∞)";
}
}
else if (type === "quadratic") {
if (isNaN(c)) c = 0;
domainText = "(-∞, ∞)";
if (a === 0) {
// Becomes linear
rangeText = (b === 0) ? "[" + c + ", " + c + "]" : "(-∞, ∞)";
} else {
// Vertex y = c – (b^2 / 4a)
var vertexY = c – (Math.pow(b, 2) / (4 * a));
var roundedY = Math.round(vertexY * 1000) / 1000;
if (a > 0) {
rangeText = "[" + roundedY + ", ∞)";
} else {
rangeText = "(-∞, " + roundedY + "]";
}
}
}
else if (type === "sqrt") {
if (isNaN(c)) c = 0;
if (a === 0) {
if (b = 0
var edgeX = -b / a;
var roundedX = Math.round(edgeX * 1000) / 1000;
if (a > 0) {
domainText = "[" + roundedX + ", ∞)";
rangeText = "[" + c + ", ∞)";
} else {
domainText = "(-∞, " + roundedX + "]";
rangeText = "[" + c + ", ∞)";
}
}
}
else if (type === "rational") {
if (isNaN(c)) c = 0;
if (a === 0) {
if (b === 0) {
domainText = "Undefined (Division by zero)";
rangeText = "Undefined";
} else {
var val = (1 / b) + c;
domainText = "(-∞, ∞)";
rangeText = "[" + val + ", " + val + "]";
}
} else {
// ax + b != 0 -> x != -b/a
var asymptoteX = -b / a;
var roundedX = Math.round(asymptoteX * 1000) / 1000;
domainText = "(-∞, " + roundedX + ") ∪ (" + roundedX + ", ∞)";
// y != c
var roundedC = Math.round(c * 1000) / 1000;
rangeText = "(-∞, " + roundedC + ") ∪ (" + roundedC + ", ∞)";
}
}
document.getElementById("domain-result").innerText = domainText;
document.getElementById("range-result").innerText = rangeText;
document.getElementById("result-area").style.display = "block";
}