Screen resolution and DPI – Super User

I’m a little confused as to how screen resolution and DPI work. It seems to me that for a given display, once you set the screen resolution the dpi should also be fixed. However, xrandr allows you to specify each of those individually. And they each seem to have different effects. For instance, decreasing my screen resolution seems to make my polybar bigger, however it does not change the size of text in my urxvt instances, even after starting a new instance of urxvt. Changing the DPI. while having no effect on polybar, adjusts the text size of my urxvt (and emacs, and some other things). So I guess what is the difference between screen resolution and DPI? How is it that setting one doesn’t fix the other? And which setting affects what programs?

Thanks