Actually, the theoretical math is not really different:
Formally speaking, a public key cryptosystem is given by:
The functions $E_k$ and $D_k$ are called encryption and decryption functions associated with the key $k \in K$.
In practical application, a user Bob chooses a key $k \in K$ and computes the functions $E_k, D_k$; he then makes $E_k$ public (e.g. on the internet), and keeps $D_k$ secret. Thanks to property (4), it should be difficult for anyone except Bob to get $D_k$. Now, suppose that a user Alice wants to send a message $m$ to Bob, and wants no one else but Bob to be able to read it: she looks for Bob's public encryption function $E_k$ on the internet, computes $c=E_k(m)$, sends $c$ trough the communication channel, Bob receives it and computes $D_k(c)$, obtaining the original message $m$ (thanks to property (1)). Even if the communication channel is not secure, any eavesdropper (say Eve) cannot deduce the message $m$ from $c$, and $c$ is the only thing that pass trough the channel.
(For the sake of clarity: usually, when dealing with a specific public key cryptosystem, the functions $E_k$ and $D_k$ are obtained from $k \in K$ in a standard way: for example, in the RSA cryptosystem, $k$ is a triple $(n, e, d)$ and the $E_k(x)=x^e$ (mod $n$), while $D_k(x) = x^d$ (mod $n$). It is clear that, if everyone knows that this cryptosystem is being used in a specific situation, keeping $D_k$ secret and making $E_k$ public is equivalent to keeping $d$ secret, and making $(n,e)$ public. This is why, in many situations, we will talk of a public key and a private key instead of a encryption function and a decryption function, but we should be aware this is exactly the same setting.)
Now, when instead of encrypting messages we want to sign messages, we just switch the use of $D_k$ and $E_k$:
Now Bob wants to put his signature onto a message $m$ (say, some kind of contract with Alice), so he computes $y=D_k(m)$ and send the pair $(m,y)$ to Alice. Everyone (included Alice) now can verify that the message was signed by Bob, simply computing $E_k(y)$ (recall $E_k$ is publicly known!) and checking this equals $m$ (again, by property (1), this is true if Bob did it right).
In conclusion, when we have a cryptosystem, it is easy to create a signature scheme, so actually the math is not different at all! And indeed, when we have an encryption system (RSA, ElGamal, NTRU,...) , we usually also have a corresponding signature scheme (RSA Signature, ElGamal Signature, NTRUSign,...)