GeoGebra link: https://www.geogebra.org/m/hscshcj8
This simulation demonstrates the power dissipated in a variable resistor given that the battery has an internal resistance (made variable in this app as well).
Since the power dissipated by the resistor is given by
and the current is given by
This power will be a maximum if the expression for the denominator
is a minimum.
Differentiating the expression with respect to R, we get
When the denominator is a minimum,