Here is a numerical example with RSA.
(Edit and warning: as fgrieu notes in the comment, these values are strictly for illustrating the math involved; all of the parameters are unsuitable for actual use. See the answers here for discussion about how to properly choose the primes $p$ and $q$, and here about secure RSA key sizes.)
Quoting the relevant parts:
The first step of RSA encryption is to generate two primes, $p$ and $q$.
$$p = 257$$
$$q = 337$$
The product of $p$ and $q$ is $n$, in our case:
$$n = 257\cdot 337 = 86609$$
The euler totient, $\phi(n)$ is calculated below:
$$\phi(n) = (p-1)(q-1) = 256\cdot 336 = 86016$$
Now we have to chose an exponent, $e$ that is relatively prime to $\phi(n) = (p-1)(q-1)$. The pair $(e, n)$ is our public key that is used to encrypt messages.
$$e = 17$$
$17$ is relatively prime to $86016$ because they share no factors. We know this because $17$ itself is a prime number, so its only factors are $1$ and $17$. $9113$ is not divisible by $17$, so the numbers are relatively prime.
Our next step is to calculate a value for $d$. If you recall from the RSA algorithm, $d$ must be chosen so that it is the inverse of $e$, modulo $n$. So for our example, we must find a number such that:
$$e\cdot d \equiv 1 \mod \phi(n)$$
$$17 \cdot d \equiv 1 \mod 86016$$
To solve for d we use the Extended Euclidean Algorithm which can be used to find multiplicative inverses.
Using the Extended Euclidean Algorithm, we can calculate one possible value for $d$ is $65777$. We can check the algorithm by computing $e*d \mod \phi(n)$ and ensuring it equals $1$.
$$e\cdot d \mod \phi(n) = 17\cdot 65777 \mod 86016 = 1118209 \mod 86016 = 1$$
$d$ is our private key and is used to decrypt our messages. Now that we have both a public key and a private key, we can encrypt and decrypt messages.
$$\hbox{Pub } = (e,n) = (17, 86609)$$
$$\hbox{Priv } = (d,n) = (65777, 86609)$$
To encrypt a message m, we first convert it into a large integer. Then we calculate m^e \mod n. The result is the encrypted message, or ciphertext, $c$. Let’s send the text “Hi”. In order to do this, we must convert the message into an integer. We’ll use the integer $18537$ to represent our text.
$$c = m^e \mod n$$
$$c = 18537^{17} \mod 86609 $$
$$c = 12448$$
Now, can we decrypt $12448$ back into the original message, $18537$? To decrypt a message we use the private key, $(65777, 88609)$
$$m = c^d \mod n$$
$$m = 12448^{65777} \mod 86609$$
Here we use the Chinese Remainder theorem, an easy way to solve $a^b \mod n$
$$m = 18537 \mod 86609$$
Indeed, when we perform decryption on our ciphertext, we are left with the original message.
One more thing:
It's my understanding that public keys are generated from the private key using a one-way, or trapdoor function
Not always. In Diffie-Hellman key exchange, you start with a private value $x$ and generate $g^x \mod p$ as a public key, given suitable $g$ and $p$ (and are known to the public). However, for RSA, you pick secret primes $p$ and $q$ and from that generate the public key $(N=pq, e)$, such that $\gcd(e, (p-1)(q-1)) = 1$. And from that you can derive the decryption exponent (private key) $d$, such that $ed \equiv 1 \bmod (p-1)(q-1)$.