Linear: f(x) = ax + b
Quadratic: f(x) = ax² + bx + c
Square Root: f(x) = a√(x – h) + k
Rational: f(x) = a / (x – h) + k
Absolute Value: f(x) = a|x – h| + k
Results
Function:
Domain:
Range:
Understanding Domain and Range in Mathematics
In algebra and calculus, every function has two fundamental sets of values: the Domain and the Range. This calculator helps you determine these intervals for the most common algebraic functions used in high school and college mathematics.
What is Domain?
The domain of a function is the complete set of possible values for the independent variable (usually x), which will make the function "work" and will output real numbers.
Rational Functions: You cannot divide by zero. The domain excludes values that make the denominator zero.
Square Root Functions: You cannot take the square root of a negative number in the real number system. The expression under the radical must be greater than or equal to zero.
What is Range?
The range is the complete set of all possible resulting values of the dependent variable (usually y), after we have substituted the domain. Finding the range often requires identifying the Vertex of a parabola or the Horizontal Asymptote of a rational function.
Real-World Examples
Example 1: Quadratic Function
Consider f(x) = x² + 2. Since x can be any number, the Domain is (-∞, ∞). Since any number squared is at least zero, and we add 2, the Range is [2, ∞).
Example 2: Square Root Function
Consider f(x) = √(x – 3). To avoid negative roots, x – 3 must be ≥ 0, so x ≥ 3. The Domain is [3, ∞). The smallest output is 0, so the Range is [0, ∞).
How to Use This Calculator
Select the Function Type from the dropdown menu.
Enter the Coefficients (a, b, c or h, k).
Click Calculate to see the result in interval notation.
function updateInputs() {
var type = document.getElementById("functionType").value;
var lblB = document.getElementById("lblB");
var lblC = document.getElementById("lblC");
var fieldC = document.getElementById("field-c");
if (type === "linear") {
lblB.innerText = "Value b (y-intercept):";
fieldC.style.display = "none";
} else if (type === "quadratic") {
lblB.innerText = "Value b:";
lblC.innerText = "Value c:";
fieldC.style.display = "block";
} else if (type === "sqrt" || type === "rational" || type === "abs") {
lblB.innerText = "Value h (shift):";
lblC.innerText = "Value k (shift):";
fieldC.style.display = "block";
}
}
function calculateDomainRange() {
var type = document.getElementById("functionType").value;
var a = parseFloat(document.getElementById("valA").value);
var b = parseFloat(document.getElementById("valB").value);
var c = parseFloat(document.getElementById("valC").value);
var resFunc = "";
var resDomain = "";
var resRange = "";
var resHint = "";
if (isNaN(a) || isNaN(b) || (type !== "linear" && isNaN(c))) {
alert("Please enter valid numbers for all fields.");
return;
}
if (type === "linear") {
resFunc = "f(x) = " + a + "x + " + b;
resDomain = "(-∞, ∞)";
resRange = (a === 0) ? "[" + b + ", " + b + "]" : "(-∞, ∞)";
resHint = "This is a straight line. Unless the slope is 0, it covers all real numbers.";
}
else if (type === "quadratic") {
resFunc = "f(x) = " + a + "x² + " + b + "x + " + c;
resDomain = "(-∞, ∞)";
var vertexX = -b / (2 * a);
var vertexY = a * (vertexX * vertexX) + b * vertexX + c;
if (a > 0) {
resRange = "[" + vertexY.toFixed(2) + ", ∞)";
resHint = "The parabola opens upwards. The minimum value is at the vertex y = " + vertexY.toFixed(2);
} else if (a 0) {
resRange = "[" + c + ", ∞)";
resHint = "The graph starts at (" + b + ", " + c + ") and goes up to the right.";
} else if (a 0) {
resRange = "[" + c + ", ∞)";
resHint = "The V-shaped graph has a vertex at (" + b + ", " + c + ") opening upwards.";
} else if (a < 0) {
resRange = "(-∞, " + c + "]";
resHint = "The V-shaped graph has a vertex at (" + b + ", " + c + ") opening downwards.";
} else {
resRange = "[" + c + ", " + c + "]";
}
}
document.getElementById("resFunc").innerText = resFunc;
document.getElementById("resDomain").innerText = resDomain;
document.getElementById("resRange").innerText = resRange;
document.getElementById("resGraphHint").innerText = resHint;
document.getElementById("dr-result").style.display = "block";
}
// Initialize labels
updateInputs();