Which is the origin of the "economic" approach to production? Economic theory states that under competitive markets, economic profits are zero (even though accounting profits are not zero). What is the origin of this analysis? Who was the first author to write about this? Who was the first to put this into mathematics? I don't know how to search for this. I know Alfred Marshall is an important economist, who wrote a widely used book, but I do not have access to it. Is it him?

Any references are most welcomed.
The book from Alfred Marshall you are talking about is "Principles of Economics"

Principles of Economics PDF

As much I know the idea for Economic Surplus (Consumer Surplus and Producer Surplus) originated from Alfred Marshall, he is considered the person who "put" mathematics in the Economics theory.