Instantly share code, notes, and snippets.

# simonw/Cauchy-Schwarz.md

Created July 9, 2022 17:44

# Explaining mathematical expressions with GPT-3

I wanted to see if GPT-3 could explain a mathematical expression for me, as a follow-on from Using GPT-3 to explain how code works. I grabbed an example from this page of the GitHub documentation.

Here's my conversation with GPT-3 as plain text - except I added >  to the lines that I entered to differentiate them from the GPT-3 output:

> Explain this:
>
> $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

This is the Cauchy-Schwarz inequality.

> Explain the formula syntax step by step, using $$wrapped around the formula steps:$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$This is the Cauchy-Schwarz inequality.$$\left( \sum_{k=1}^n a_k b_k \right)^2$$This is the sum of all products of corresponding elements in the vectors a and b, squared.$$\leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$This is saying that this sum is less than or equal to the product of the sums of the squares of each vector.  The reason I said "using$$ wrapped around the formula steps" was to get the output to be produced in the syntax that GitHub Markdown understands. It worked! Here's the rendered version of my conversation:

Explain this:

$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

This is the Cauchy-Schwarz inequality.

Explain the formula syntax step by step, using $$wrapped around the formula steps:$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$This is the Cauchy-Schwarz inequality.$$\left( \sum_{k=1}^n a_k b_k \right)^2$$This is the sum of all products of corresponding elements in the vectors a and b, squared.$$\leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)

This is saying that this sum is less than or equal to the product of the sums of the squares of each vector.