RationalExpressionQ[expr,x]
gives True if expr is structurally a rational expression in x, and False otherwise.
RationalExpressionQ[expr,{x,y,…}]
gives True if expr is structurally a rational expression in x,y,…, and False otherwise.
RationalExpressionQ[expr,{x,y,…},test]
gives True if expr is structurally a rational expression in x,y,… with coefficients satisfying test, and False otherwise.
RationalExpressionQ
RationalExpressionQ[expr,x]
gives True if expr is structurally a rational expression in x, and False otherwise.
RationalExpressionQ[expr,{x,y,…}]
gives True if expr is structurally a rational expression in x,y,…, and False otherwise.
RationalExpressionQ[expr,{x,y,…},test]
gives True if expr is structurally a rational expression in x,y,… with coefficients satisfying test, and False otherwise.
Details
- A rational expression in x,y,… is an expression constructed with x,y,… and coefficients not containing x,y,…, using Plus, Times and integer Power.
- RationalExpressionQ[expr,vars,NumericQ] tests whether expr is a rational expression in vars with numeric coefficients.
Examples
open all close allBasic Examples (3)
Test whether an expression is rational in the specified variable:
RationalExpressionQ[x ^ 3 - a / x + (3x - 1) / (x ^ 4 + 1), x]RationalExpressionQ[E ^ x - x, x]Test whether an expression is rational in the specified set of variables:
RationalExpressionQ[x ^ 2 / (y - x ^ 3) + Sin[z]x / y, {x, y}]RationalExpressionQ[x ^ 2 / (y - x ^ 3) + Sin[z]x / y, {x, y, z}]Test whether an expression is rational with numeric coefficients:
RationalExpressionQ[(x ^ 2 - 2x y + y) / (3x + 4y / x), {x, y}, NumericQ]RationalExpressionQ[(x ^ 2 - a x y + y) / (b x + 4y / x), {x, y}, NumericQ]Scope (4)
Multilevel fractions are rational expressions:
f = x / (1 + 1 / (x - 1 / x)) + (2 + 3 / x) / xRationalExpressionQ[f, x]Coefficients of rational expressions may involve arbitrary functions:
RationalExpressionQ[Sin[a]x / (E ^ b y ^ 2 + Gamma[c]x y), {x, y}]Variables need not be symbols:
RationalExpressionQ[x[1] ^ 2 + 1 / (x[2] ^ 3 + 2), {x[1], x[2]}]Variables need not be independent of each other:
RationalExpressionQ[x / (x Sin[x] + 1), {x, Sin[x]}]Properties & Relations (2)
Together represents rational expressions as ratios of polynomials:
f = x / (y + 1 / (x - 1 / y)) + (x ^ 2 + 3 / y) / xRationalExpressionQ[f, {x, y}]Together[f]Use NumeratorDenominator to extract the numerator and the denominator:
NumeratorDenominator[%]Use PolynomialExpressionQ to verify that the resulting expressions are polynomials:
PolynomialExpressionQ[#, {x, y}]& /@ %Rational expressions represent functions that are singular at zeros of the denominators:
f = x / (1 + 1 / (x - 2 / x)) + (3 + 5 / x) / (5x + 6)RationalExpressionQ[f, x]Use FunctionSingularities to find the singularities:
FunctionSingularities[f, x]Outside zeros of the denominators, rational expressions represent analytic functions:
FunctionAnalytic[{f, Not[%]}, x]Possible Issues (3)
A rational expression may not represent a rational function due to hidden division by zero:
f = 1 / ((x + 1)(x - 1) - x ^ 2 + 1)RationalExpressionQ[f, x]ExpandDenominator[f]A nonrational expression may represent a rational function:
f = x Sin[x] ^ 2 + x Cos[x] ^ 2RationalExpressionQ[f, x]Simplify[f]RationalExpressionQ is purely syntactic:
{f, g} = {Sin[x] / (Cos[x] + 1), Sin[x] ^ 2 / Cos[x]}RationalExpressionQ[f, {Sin[x], Cos[x]}, NumericQ]Syntactically, Tan[x] is a coefficient, free of Sin[x] and Cos[x]:
RationalExpressionQ[g, {Sin[x], Cos[x]}, NumericQ]Related Guides
History
Text
Wolfram Research (2020), RationalExpressionQ, Wolfram Language function, https://reference.wolfram.com/language/ref/RationalExpressionQ.html.
CMS
Wolfram Language. 2020. "RationalExpressionQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RationalExpressionQ.html.
APA
Wolfram Language. (2020). RationalExpressionQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RationalExpressionQ.html
BibTeX
@misc{reference.wolfram_2026_rationalexpressionq, author="Wolfram Research", title="{RationalExpressionQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/RationalExpressionQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_rationalexpressionq, organization={Wolfram Research}, title={RationalExpressionQ}, year={2020}, url={https://reference.wolfram.com/language/ref/RationalExpressionQ.html}, note=[Accessed: 13-June-2026]}