M2221-L04 — Symbolic reasoning and honest mathematical visualization
Prerequisites: algebra, differentiation and elementary complex numbers. The symbolic MATLAB examples require Symbolic Math Toolbox.
1. A symbolic expression carries a domain and assumptions
A symbolic system manipulates formal expressions subject to declared mathematical rules. Before accepting a simplification, identify the variable domain, parameter restrictions, branch conventions and excluded denominator zeros. An equality of formulas on a common domain is not automatically equality of two functions with different domains.
For real , , not without the assumption . For complex , the principal square root is branch dependent and fails, for example at . Cancelling
is valid only for in the original expression. A system returning has not proved the original function is defined at one. A continuous extension is a new explicitly defined function.
MathWorks documents both assumption management and simplification, including the distinction between expressions formed numerically first and expressions formed symbolically. Consult the official symbolic simplification guide and assumptions guide. A safe illustrative session uses separate variables for separate assumptions:
syms xr real
syms xp positive
s_real = simplify(sqrt(xr^2));
s_positive = simplify(sqrt(xp^2));
assert(isAlways(s_real == abs(xr)));
assert(isAlways(s_positive == xp));
q_exact = sym(1)/10;
The last line forms the exact rational one tenth, rather than first computing a binary floating-point approximation and then converting it. Existing assumptions may persist independently of a workspace variable; record and reset them through the documented symbolic workflow rather than relying on an unexplained interactive history.
Worked example 4.1.1
(Domain bookkeeping for a cancelled rational function)
Let . Its natural real domain excludes the zeros of the denominator, . Factoring gives
The two excluded points behave differently. At the common factor cancels and ; the singularity is removable, and the function , which is defined at , is a new function that extends . At the numerator equals while the denominator tends to zero, so and the graph has a vertical asymptote there. The simplified formula also changes the answer to equations. The equation reduces to , and is in the domain, so it is a solution. The equation reduces to , that is , which is excluded: never takes the value , although does.
Quick check
(Simplify and state the set of real on which the simplification is valid.)
Factor numerator and denominator completely before cancelling.
Solution · Answer
, valid exactly for and , the zeros of the original denominator. The original expression is undefined at and even though is defined there.
2. Symbolic verification needs a mathematical interpretation
For a proposed polynomial identity, expand the difference and check every coefficient is zero. For a rational identity, record the nonzero-denominator domain, multiply by a common denominator and verify the resulting polynomial identity. For a proposed antiderivative , differentiate and compare with on a stated interval or domain.
Worked example: partial fractions. On ,
Multiplying by gives , an exact polynomial identity. Integrating on each real interval separated by the poles gives
The constant may differ between disconnected intervals. A complex logarithm antiderivative instead needs a selected branch on a permitted domain; silently exchanging real absolute-value logs and complex branch logs is invalid.
A numerical spot check can disprove an identity by finding a valid point of disagreement, but agreement at finitely many arbitrary points does not prove a general functional identity. For a polynomial of known degree at most , agreement at distinct exact points does prove equality by the root bound; floating-point near-agreement is not that exact theorem.
Worked example: extraneous roots. Squaring gives , with candidates two and minus one. The original square root is nonnegative, requiring ; substitution accepts two and rejects minus one. A solver's polynomial candidate list is not the final solution set of the original radical equation.
Worked example 4.1.2
(Two antiderivatives that differ by different constants)
Both and have derivative wherever they are defined: by the chain rule
So differentiation verifies as an antiderivative on each of the intervals and , but not on , since is undefined at zero. On each interval has zero derivative and is therefore constant. Evaluating at gives on ; at it gives on . The constants differ between the two components. The distinction is not cosmetic: , whereas the formal difference has the wrong sign, because is not an antiderivative on an interval containing .
Quick check
(Solve over the reals, keeping the original equation's conditions.)
Square, solve the polynomial equation, then test each candidate in the original equation.
Solution · Answer
The right side must be nonnegative, so . Squaring gives , with candidates and . The candidate violates (indeed ); the candidate satisfies . The solution set is .
3. Symbolic stationary points are not automatically global extrema
For on , gives interior critical points . The function is continuous on a compact interval, so a global maximum and minimum occur at critical points or endpoints. Values are , , . Hence the global minimum is minus one at and maximum is eight at the endpoints. Merely solving would miss the maxima.
When a derivative formula divides by an expression, check its zero set separately. On an open or unbounded interval, a finite stationary-point list alone cannot guarantee a global extremum; endpoint limits or behaviour at infinity may matter. Symbolic software can assist each calculation, but the compactness and completeness argument is mathematical.
Counterexample mode
An open interval can have no global minimum
Claim: on any interval, the smallest value at a critical point is the global minimum. Take on the open interval . Here , so the critical points are , with and . Yet , and since increases on , its values approach as without reaching it: has no global minimum on . Repair: on a closed bounded interval compare critical values with endpoint values; on an open interval also examine the limits at the ends.
Worked example 4.1.3
(Global extrema of a rational function on a closed interval)
Find the global extrema of on . The denominator is never zero, so is continuous on the closed bounded interval and both extrema exist. The quotient rule gives
which exists everywhere and vanishes only at , both interior points. The complete candidate list is therefore , with values
The global maximum is at and the global minimum is at . Here the endpoints are not extreme, but they had to be checked: the argument is the comparison of a complete finite list, and that list is complete only because is differentiable on the interior and the interval is closed.
Quick check
(Find the global maximum and minimum of on .)
List the interior critical points that lie in the interval, then add the endpoints.
Solution · Answer
vanishes at , but only lies in . The candidates are with values , , . The global minimum is at and the global maximum is at the endpoint .
4. Plot discontinuities rather than drawing fictitious bridges
A graph is a finite sample plus a rendering rule. Joining sampled points by line segments asserts visual continuity between them. For , a single line crossing from a negative sample to a positive sample near zero can create a fictitious bridge across a vertical asymptote.
xleft = linspace(-2,-0.05,400);
xright = linspace(0.05,2,400);
plot(xleft,1./xleft,'b-',xright,1./xright,'b-');
xlabel('x'); ylabel('1/x'); grid on;
title('Two domain components; x=0 excluded');
The exclusion width is a visualization choice, not a declaration that the function is undefined on that whole gap. Report it. A second view with a smaller gap checks whether important near-pole behaviour has been clipped. Alternative workflows insert a missing-value separator, but must avoid accidentally rejoining components.
For as a real function, plot only ; complex outputs outside that interval should not be silently discarded as though they were real values. State whether the graph is of the function, its real part, modulus or another derived quantity.
Aliasing example. Sampling at gives zero at every node, although the function is not zero between them. A flat sampled plot can therefore hide oscillations completely. Increase sampling density and vary the grid offset; where a frequency bound is known, use an appropriate sampling theorem. Without such a bound, a finite sample cannot certify absence of narrow spikes or arbitrarily fast oscillations.
5. Two-dimensional visualizations need coordinates, scale and invariants
For a scalar field , a surface plot encodes height while contours encode level sets. A faithful plot labels coordinates, units and the function. For a vector field, arrows encode both direction and chosen length scaling; normalizing all arrows removes magnitude information and must be disclosed.
For the linear map , map a sampled unit circle through . The image is an ellipse. The signed area scale is ; an equal-aspect display is essential to compare geometric shapes. Its principal semiaxis lengths are singular values of , not necessarily its eigenvalues. Check geometry with the invariant , not a visually guessed angle.
For a complex map , one possible visualization maps a grid of horizontal and vertical line segments and colours the two families differently. Away from zero the crossing angles remain right angles because the complex derivative is nonzero; at zero the derivative vanishes and the local angle-preservation conclusion does not apply. Domain colouring instead displays argument and modulus, which requires an explicit legend and a rule for zero and very large magnitudes. Colour discontinuities at an argument cut can reflect a display convention rather than a discontinuity of the function.
Every figure should have an accessible textual statement of the mathematical conclusion. Colour alone should not distinguish essential groups; combine line style, labels or symbols. If a picture suggests a theorem, write the hypotheses and proof separately.
6. A complete laboratory submission
Submit a clean script and a short report containing: declared domains and assumptions; exact symbolic steps; numerical checks at valid points; plots with sampling ranges, counts and exclusions; and a conclusion distinguishing proved statements from visual or numerical evidence. Keep exact and approximate quantities visibly distinct. If symbolic software is unavailable, perform the exact coefficient, derivative and domain checks by hand; report that limitation rather than inventing software output.
7. Exercises
P01 — Foundation. Simplify for real and for positive real . Give a real counterexample to the unconditional simplification .
P02 — Core. Solve with the original domain intact.
P03 — Core. Simplify and solve its equality to four, respecting the original domain.
P04 — Core. Find all global extrema of on with a completeness justification.
P05 — Diagnosis. Why can a line plot of containing samples on both sides of zero mislead? Give two repairs.
P06 — Proof. If two polynomials of degree at most four agree at five distinct exact points, prove they are equal. Explain why five approximate floating-point checks do not give the same proof.
P07 — Core. Find the eigenvalues of for the matrix in §5, and hence the ellipse's principal semiaxis lengths.
P08 — Extension. Explain how grid sampling can make look identically zero. Design a revised experiment that can reveal the hidden oscillation, and state why this remains an experiment rather than a general proof about all functions.
8. Full solutions
P01. For real the nonnegative square root of is . For positive real it is . At , , disproving the unconditional rule.
P02. The original equation requires and its right side must be nonnegative, so . Squaring gives . Only survives the sign condition, and substitution verifies . Thus the solution set is .
P03. On it simplifies to . The equation has candidate , which is excluded. The original equation has no solution; cancellation did not fill the hole.
P04. Continuity on the compact interval guarantees extrema. All interior extrema must have derivative zero, giving ; include endpoints . Comparing values yields minima at , maxima eight at . This finite candidate list is complete because differentiability holds throughout the interior.
P05. The renderer can join samples across the missing domain point, drawing a bridge that is not part of the graph. Plot the two components as separate curves, or insert an explicit missing-value break between them. Also label the excluded point and state any clipped vertical range.
P06. Their difference has degree at most four and five distinct roots, hence is the zero polynomial. Approximate equalities are not roots: a small nonzero polynomial or rounding error can produce tiny values at every tested point without vanishing identically. Exact coefficients or certified error bounds are needed for a different rigorous conclusion.
P07. , with characteristic polynomial . Its eigenvalues are , both positive. The semiaxis lengths are and , whose product is two, agreeing with the area scale .
P08. At , and every sample vanishes. A denser grid such as spacing , combined with an offset grid and direct evaluation of intermediate extrema, reveals nonzero values. The identity gives an exact known frequency for analysis; without comparable regularity or frequency information, any fixed finite sampling plan can miss another function's narrower or faster features.
9. Summary
Symbolic algebra is trustworthy only with domains, assumptions and exact-input discipline. Visualization is trustworthy only with declared sampling, geometry, exclusions and encoding. Neither a returned expression nor a convincing picture removes the need to prove the mathematical claim it is being used to support.