# Let `y = (x+1)(x^2+1)`. Find the derivativeby first using the product rule and then by multyplying the factors first and then taking the derivative.

*print*Print*list*Cite

So, we're going to calculate the derivative in 2 ways.

**Calculating the Derivative Based on Product Rule**

First, we'll use the product rule, stated here (also, see link below):

Given two functions of x, f(x) and g(x), the following holds true:

`d/(dx)(f*g) = g(df)/(dx)+f(dg)/(dx)`

Put another way,

`(f(x)g(x))' = f'(x)g(x) + f(x)g'(x)`

In this problem, we can define f(x) and g(x) in the following way to find the derivative using the product rule:

`f(x) = x+1`

`g(x) = x^2+1`

Given this information, we can calculate these functions' derivatives:

`(d(f(x)))/(dx)=1`

`(d(g(x)))/dx = 2x`

Now, we can use the product rule to find the derivative of y(x) above:

`dy/dx = d/dx(f(x)g(x)) = (1)(x^2+1) + (x+1)(2x)`

Simplifying:

`dy/dx = x^2 + 1 + 2x^2 + 2x`

`dy/dx = 3x^2 + 2x + 1`

And there is the derivative that we calculated based on the product rule.

**Calculating Derivative by simplifying the Original Function First**

Now, we'll first simplify y(x) before attempting to calculate the derivative.

`y(x) = (x+1)(x^2+1)`

We can use the FOIL method to simplify this function:

`y(x) = x^3 + x + x^2 + 1`

For conveience, let's reorder the terms:

`y(x) = x^3 + x^2 + x + 1`

Now, we can take the derivative fairly easily:

`dy/dx = 3x^2 + 2x + 1`

Thankfully, this is equivalent to the derivative we calculated using the product rule! We know now that we have the right function that represents `dy/dx`.