14.8: Simplifying, Expanding, and Factoring Expressions

Fundamentals of MATLAB Programming · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC-SA, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    14.8: Simplifying, Expanding, and Factoring Expressions

    Symbolic math is also useful for algebraic manipulation. MATLAB can simplify expressions, expand products, and factor polynomials.

    simplify

    The simplify function attempts to rewrite an expression in a simpler form.

    Example \(\PageIndex{1}\)
    syms x
    expr = cos(x)^2 + sin(x)^2;
    simplified_expr = simplify(expr)
    Solution
    sBecause cos^2(x) + sin^2(x) = 1, MATLAB should simplify this expression to 1.
    implified_expr =
    
    1

    expand

    The expand function multiplies out an expression when possible.

    factor

    The factor function does the reverse when possible: it rewrites an expression as a product of factors.

    Example \(\PageIndex{2}\)
    syms x
    myexpr = (x + 2)*(x - 1);
    
    expanded_expr = expand(myexpr)
    
    factored_expr = factor(expanded_expr)
    
    Solution
    expanded_expr = x^2 + x - 2
    
    factored_expr = [x + 2, x - 1]
    

    This page titled 14.8: Simplifying, Expanding, and Factoring Expressions was last modified on Tue, 30 Jun 2026 02:11:43 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.