You do not decide between the chain rule and the product rule by looking at the function. You decide by asking what you would do last if someone handed you a number and told you to evaluate it by hand.
That is the whole test. It takes about five seconds, it works on every problem I have ever handed a student, and it is faster than trying to remember which rule "goes with" which kind of function. Most people who mix these two up are pattern matching on what the function looks like. The structure is what decides it, and the last operation is how you find the structure.
The test: what is the last thing you would do?
Pick a number. Three is fine. Now walk through evaluating the function at x = 3, in the order you would actually press the buttons. The final operation you perform is the outermost operation, and that is the rule you need.
Try it on sin(3x). At x = 3 you would multiply to get 9, then take the sine of 9. Sine came last. The sine is wrapped around something, so this is a composition, and compositions get the chain rule.
Now try x cos(x). At x = 3 you would compute cos(3), and separately you have 3, and then you multiply them. Multiplication came last. Two separate things multiplied together is a product, and products get the product rule.
Same two ingredients in both, x and a trig function. Completely different structures. Looking at the symbols will not tell you which is which. Asking what happens last will.
One more case belongs in the test, because it catches people out constantly. If the last operation is addition or subtraction, you need neither rule. In x² + sin(3x) the final step is adding two results together, so you differentiate each term separately and add the answers, giving 2x + 3cos(3x). Sums split apart. Products and compositions do not. A good share of the students who tell me they cannot decide between the two rules are looking at a sum and trying to force it into one of them.
Product rule: two things multiplied
You are in product territory when the function is genuinely two factors sitting side by side, each of which you could evaluate on its own without the other.
OpenStax states the product rule as: if j(x) = f(x)g(x), then j′(x) = f′(x)g(x) + g′(x)f(x). Differentiate the first, keep the second, plus differentiate the second, keep the first.
The tell is that you can cover one factor with your thumb and the other still makes sense as a complete function. In x²ex, cover ex and you still have x². Cover x² and you still have ex. Both halves stand alone, so they are factors, not layers.
Chain rule: something tucked inside something
You are in chain territory when one function has been dropped into the input slot of another. There is an outside and an inside, and the inside is not a complete answer on its own.
The formal version from OpenStax on the chain rule: for h(x) = f(g(x)), the derivative is h′(x) = f′(g(x))g′(x). Differentiate the outside, leave the inside alone, then multiply by the derivative of the inside.
That last multiplication is the part people drop. In ex², cover the x² with your thumb and you are left with e to the power of nothing. It is not a standalone factor, it is an argument. The exponent is inside the exponential, so the exponential is outermost, and the derivative of the inside has to come along.
Six functions, sorted in five seconds each
- x cos(x) → last step is multiply → product. Derivative: cos(x) − x sin(x).
- sin(3x) → last step is take a sine → chain. Derivative: 3cos(3x).
- (x² + 1)5 → last step is raise to the fifth → chain. Derivative: 5(x² + 1)4 · 2x, which tidies to 10x(x² + 1)4.
- x²ex → last step is multiply → product. Derivative: 2xex + x²ex.
- ex² → last step is exponentiate → chain. Derivative: 2xex².
- ln(x)√x → last step is multiply → product. Derivative: (1/x)√x + ln(x)/(2√x), which collapses to (2 + ln x)/(2√x).
Notice that pairs two and five look nothing alike and take the same rule, while pairs one and two look almost identical and take different ones. Appearance is not the signal. Position is.
When the answer is both
Plenty of real problems need both rules, and students freeze here because they think they have to pick one. You do not. The last operation still decides which rule you start with, and the other rule shows up inside it.
Take x²sin(3x). At x = 3 you would square, you would separately do the sine of 9, and then you would multiply. Multiplication is last, so you open with the product rule:
2x · sin(3x) + x² · [derivative of sin(3x)]
That bracket is a small chain rule problem all by itself. Work it and you get 3cos(3x). Put it back where it came from: 2x sin(3x) + 3x²cos(3x). One rule got you in the door. The other finished off a piece.
Nested chains are the same trick twice. Take sin²(3x). The last thing you do is square it, so squaring is the outer layer. Start there and you have 2sin(3x). Now, what was inside? sin(3x). That is a chain rule problem of its own, worth 3cos(3x). Multiply the two together and you are done: 6sin(3x)cos(3x). Peel one layer, then peel the next. Nobody expects you to see both at once.
Where this actually goes wrong
Three failure modes account for nearly every lost mark I see on this topic.
Forgetting the inside derivative. Writing sin(3x) → cos(3x) is the slip I see more than any other in a first calculus course. The rule is not "differentiate the outside." It is "differentiate the outside and then multiply by the derivative of the inside." Whenever the inside is plain x, that extra factor is just 1 and vanishes from view, which is precisely how students stop expecting it to be there at all.
Reading a product as a composition. The parentheses in x cos(x) are doing nothing except holding cos's argument, but they look like nesting. Run the thumb test: cos(x) stands alone, x stands alone, so it is a product.
Panicking at quotients. Honestly, a fraction is not a fourth thing to learn. Take x/(x² + 1). You can run it through the quotient rule if that is the one you like. Or rewrite it as x(x² + 1)−1 and use product and chain together. You get (1 − x²)/(x² + 1)² either way. Pick whichever one you actually remember under pressure.
Worth flagging separately, because it is a different animal. Once y is no longer sitting alone on one side, none of this applies. Take x² + y² = 25. That is not something you differentiate the way we have been doing here. It needs implicit differentiation. I see students grab the chain rule, stall, and decide they have forgotten how it works, when the setup was never the same to begin with.
Try it on the next ten problems
Do not do the derivatives. Just write "product" or "chain" next to each one, spending no more than a few seconds each, then check yourself. Sorting the structure is a separate skill from executing the rule, and it is the one that transfers, because it is what you will be doing under time pressure on an exam.
When a verdict feels shaky, the question to ask is not what the answer is. It is why the structure is what it is. Run one through a step-by-step derivative walkthrough, then ask which operation got treated as the outermost one. That fixes the confusion faster than grinding out another ten of the same problem. The other topic calculators behave the same way, and this last-operation habit follows you into integration, where you end up running the same logic backwards.
