Cant you look at the algorithm used to encrypt and find the private key from the public key that way?
Welcome to the wonderful (and nonintuitive) world of public key cryptography.
In this world, we can generate a 'public key' and a 'private key'; with the 'public key', we can encrypt a message that can only be decrypted with the 'private key'. And, yes, you can examine the public key and the encryption program all you want; that doesn't tell you how to decrypt (!).
Here is a simple example ("IES") of such a scheme:
The public key will consist of a large prime $p$, a smaller value $g$, and the value $pub = g^x \bmod p$ [1], for some secret value $x$.
The private key will consist of everything in the public key, and the secret value $x$.
To encrypt, you pick a random value $y$ and compute both $g^y \bmod p$ and $pub^y \bmod p$. You then turn the value $pub^y \bmod p$ into a symmetric key (e.g. an AES key), and use it to encrypt your message. You then send the encrypted message and the value $g^y \bmod p$
To decrypt, you take the value $g^y \bmod
p$ sent by the encryptor, and compute $(g^y \pmod p)^x \bmod p$; this value will happen to be the same as $pub^y \bmod p$; you turn this into a symmetric key (the same key as the encryptor used) and use it to decrypt the encrypted message.
To someone in the middle, he has the public key ($p, g, pub^x \bmod p$), and the ciphertext ($g^y \bmod p$, encrypted message). For a well chosen prime $p$ and value $g$, we don't know how to take that and turn it into the common value $pub^y \bmod p$; even though the decryptor can do it easily.
This is only a sample of public key cryptography; there's a lot more to it.
[1]: What $g^x \bmod p$ means is $g$ multiplied by itself $x$ times, all modulo the prime $p$. This can be practically done, even if $x$ is large, by noticing that we don't actually have to do $x-1$ multiplications by simplifying things, for example, $g^4 \bmod p$ can be performed by 2 multiplications, not 3, by $((g^2 \bmod p)^2 \bmod p)$ - it turns out these sorts of shortcuts allow us to compute everything with $O(\log x)$ multiplications with no internal value becoming larger than $p^2$