I know this formula can be derived in 2 ways, and not sure of the best one for you, so I will show both of them. Summed up I would call them "Thin lens method" and "two surface method" or "two index method"
The thin lens method is most simple, so I will start with that...
Assume the thin lens (magically) turns the light at a changing slope that increases the further one enters away from the center of the lens, if you cannot do this, move on to the "two surface method". In the real world the rate of changing slope as a ray enters further away from the center of the lens depends on a lot of things, but in this case let's just say this is linear. So let's use "$r$" to represent the distance from the center of the lens that the light ray enters and "$m$" to represent the slope of entry relative to the normal of the lens. I use "$P$" to represent the constant that "$r$" should be multiplied by to get the value of the slope change. So if we have an object at "$S_1$" from the lens and "$R$" from the center axis, we know one ray passing through the center of the lens will have no slope change, let's call this the "chief ray". We can know the slope of a different ray with this $$ m_{in} = { R - r \over S_1} $$ Now this slope is changed with "$r$" and "$P$"... $$ m_{out} = m_{in} + r * P = { R - r \over S_1} + r * P $$ Remember $$ m_{chief}={R \over S_1} $$ So given the new slope, we will observe an intersection with the "chief ray" at: $$ S_0 = {r \over (m_{out}-m_{chief})} $$ $$ {1 \over S_0}={m_{out} \over r}-{m_{chief} \over r} ={{ R - r \over S_1} + r * P \over r}-{R \over r * S_1}={{ R - r \over r * S_1} + P }-{R \over r * S_1} $$ Now we can know the relation between "$P$", "$S_1$", and "$S_2$" is: $$ {1 \over S_0}+{R \over r * S_1}-{{ R - r \over r * S_1} } = P ={1 \over S_1} + {1 \over S_0} $$ Thus: $$ P={1 \over f} $$ $$ \space $$
The "two surface method" uses the index of refraction properties, so unless Snell's Law has been covered, this method probably cannot be. 586
Also keep in mind an ideal lens is made with parabolic curves, though most real lenses use spherical surfaces. Mostly for ease of manufacturing and compatibility with other lenses(also spherical), this is why we get spherical aberrations. I am not going to try and explain the math behind spherical lenses, as they do not work like ideal lenses. So we start with Snell's Law and move toward defining one over the focal length.
If we are using a parabolic lens than we know the surface has a slope relative to the line perpendicular to the lens of: $$ m_{s1} = {1 \over r} \space \space \space \space \space \space and \space on \space the \space other \space side \space \space \space \space \space \space m_{s0} = {- 1 \over r} $$ Using the same variables as before: $$ m_{in} = { R - r \over S_1} $$ $$ m_{chief}={R \over S_1} $$ Only this time a difference between the distance from the object to the actual lens surface and the distance "$S_1$" exists. Just to note that fact. We will say that the plane, of which "$S_1$" is the distance to from the object, is the plane an ideal lens would be placed at to simulate the same result as this real system with an index "$n$". We will also assume air has an index of one. For the "chief ray" we know the ray should be directly perpendicular to the surface. Thus this ray will exit at a point on the lens that also has a surface perpendicular to the ray. 586