> For the complete documentation index, see [llms.txt](https://www.mlcompendium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.mlcompendium.com/deep-learning/calculus.md).

# Calculus

A deep net is trained by optimizing a loss function, and that means taking derivatives through matrices, not single numbers. This page is the starting point for the matrix calculus used when differentiating through neural nets: one explained.ai note to read first, and an open invitation to grow the page.

The note to read first is [Start here!](https://explained.ai/matrix-calculus/), "The Matrix Calculus You Need For Deep Learning". It starts from the fact that most of us last saw calculus in school, even though derivatives are a critical part of training deep neural networks, and tries to explain all the matrix calculus needed to understand that training while assuming nothing beyond calculus 1.

That one note is all the page holds for now. Help needed to make this page great, [please contact me](mailto:ori@oric).

## Deprecated links

{% hint style="warning" %}
These links and images no longer work. The original wording is kept here. A same-resource copy, when one was checked, is used above.
{% endhint %}

* Start here! This address no longer opens: <http://parrt.cs.usfca.edu/doc/matrix-calculus/>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.mlcompendium.com/deep-learning/calculus.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
