## Introduction to Simplify Matlab

MATLAB is a programming environment that is interactive and is used in scientific computing. It is extensively used in a lot of technical fields where problem-solving, data analysis, algorithm development, and experimentation is required. The discipline-specific software is extensively written using MATLAB. In this topic, we are going to learn about Simplify Matlab.

MATLAB provides us with a lot of mathematical functions, useful in various computational problems. In this article, we will studytheMATLAB function used for simplification of expressions; ‘simplify’

As the name suggests, the Simplify function helps us in getting an algebraic expression in its simplest form. Though simplification is subjective, i.e. it could mean different to different users, the objective of a simplifying function is to put the expression in the best possible form.

An expression might look simplified to one user whereas the other might find it not that simplified.

### Syntax of Simplify Matlab

Let us understand the Syntax of Simplify function in MATLAB

`A = simplify (expression)`

**Description of Simplify Function in Matlab:**

`A = simplify (expression)`

- simplify (expression) function will perform the simplification of algebraic expression passed as an argument
- If the expression is symbolic matrix or vector, simplify function will simplify every element of the expression

### Examples of Simplify Matlab

Let us understand simplify (expression) with a couple of examples:

4.5 (4,418 ratings)

View Course

#### Example #1

First, let us take a simple algebraic expression as the input

`Expression = (1 – x^2)/((1 - x)* (1 + x))`

We know that 1 – x^2 in algebra gives (1 – x) * (1 + X)

So, our simplified output must be 1.

**Syntax:**

```
syms x[initializing x]
simplify ((1 – x^2)/((1 - x) * (1 + x)))[passing the input expression]
```

**Input:**

`syms x`

simplify ((1 - x^2)/((1 - x) * (1 + x)))

**Output:**

As we can clearly see in the output, our algebraic expression is simplified, and the output is as expected by us, i.e. 1

#### Example #2

Let us now take another example with more complicated calculations and higher powers.

`Expression = (1 – x^2) /((1 - x) * (1 + x)^4)`

If we simplify this manually, the output will be 1/(x + 1)^3

**Syntax:**

```
syms x y[initializing x]
simplify((1 – x^2) /((1 - x) * (1 + x)^4))[passing the input expression]
```

**Input:**

`syms x y`

simplify((1 - x^2) /((1 - x) * (1 + x)^4))

**Output:**

As we can see in the output, our algebraic expression is simplified, and the output is as expected by us,i.e1/(x + 1)^3.

#### Example #3

Next, let us take a trigonometric expression for simplification

`Expression = (cos(x)^2 – sin(x)^2) * (x^2 - 1)`

If we simplify this manually, the output will be cos(2*x)*(x^2 – 1)

**Syntax:**

```
syms x [initializing x]
simplify((cos(x)^2 – sin(x)^2) * (1 – x^2))[passing the input expression]
```

**Input:**

`syms x`

simplify((cos(x)^2 - sin(x)^2) * (1 - x^2))

**Output :**

As we can clearly see in the output, our algebraic expression is simplified, and the output is as expected by us,i.ecos(2 * x) * (x ^ 2 – 1)

#### Example #4

Next, let us take an expression which has both trigonometric & algebraic expression

`Expression = (sin(x)^2 + cos(x)^2)*(x^2 + x + 1)*(x^2 + 1)*(x^2 - x + 1) * (x^4 – x^2 + 1)`

If we simplify this manually, the output will be x^10 + x^8 + x^6 + x^4 + x^2 + 1

**Syntax:**

```
syms x[initializing x]
simplify((sin(x)^2 + cos(x)^2)*(x^2 + x + 1)*(x^2 + 1)*(x^2 - x + 1) * (x^4 – x^2 + 1))[passing the input expression]
```

**Input:**

`syms x`

simplify((sin(x)^2 + cos(x)^2)*(x^2 + x + 1)*(x^2 + 1)*(x^2 - x + 1) * (x^4 - x^2 + 1))

**Output:**

As we can see in the output, our algebraic expression is simplified, and the output is as expected by us, i.ex^10 + x^8 + x^6 + x^4 + x^2 + 1

### Conclusion

So, in this article, we learned how the Simplify function works in MATLAB. We can use the simplified function to obtain the simplified version of expression passed in the input array.

Simplify function can be used on algebraic expressions and also on the trigonometric expressions.

### Recommended Articles

This is a guide to Simplify Matlab. Here we discuss How the Simplify function works in MATLAB along with programming examples. You may also have a look at the following articles to learn more –