I learned about amortized analysis and the potential method, I also leaned an example of a binary counter which I think I understand well.
In the case of the binary counter I understand the choice of the potential function - we are paying in advance for a transition from one to zero that must be made in the future when a bit changes from zero to one so the potential function is how much I payed that I haven't used already.
I got an exercise to find a potential function for a dynamic array with only inserts. I understand why a dynamic array have an amortized time of $O(1)$ on inserts - either the array have sufficient size and there is a simple insert costs $O(1)$ or the array is of size $k$ and it is full and in that case we spread the cost of the $O(k)$ is costs to insert the element with the last $k/2$ elements of the array (the new elements), the amortized cost is somewhat of $O(k)/(k/2)=O(1)$.
However I can't come up with a potential function, I don't see a methodical way of taking this understanding and making it formal with the potential method.
I have found online a potential function $\Phi=2n-m$ where $n$ is the number of current elements in the array and $m$ is the size of the array, I do see a factor of $2$ maybe relating to the $2$ in the $k/2$ above, but I can't manage to get to the above $\Phi$ myself.
I would appreciate help in understanding how to take my argument and derive $\Phi$ from it