A tragicomedy is a work that combines tragedy and comedy together in a way that accentuates both. The key to a tragicomedy is that the tragic and comic elements have to be closely related. If they are merely intersposed, what you have is a black comedy, a work of absurdism, or a tragic work with some light comic relief.
While the genres of tragedy and comedy may seem to be diametrically opposed, they do have one thing in common, which is that both have a moment of revelation and thus release. That is actually what separates tragedy from just the normal grind and sadness of life, that there comes a point in a tragedy where the flaws and mistakes of the protagonist are clearly and absolutely revealed, something that sadly does not happen in real life. In other words, what tragedy and comedy have in common is that they both have a punch line, when the tension of circumstances is released. This is what makes tragedy also a type of comedy, because it still allows a minute of release and revelation that is not available in even the most trying of real-life situations.
The more specifically comic aspect of the tragicomedy is that the audience is usually presented with a way that the tragedy can be overcome, even if the characters are not. This is comic in the sense that it presents an ironic dichotomy to the viewer, while also is comic in the sense that it provides the possibility of a happy ending, even if it is not consumated. When presented with lost opportunities, the tragedy comes from the fact that they are lost, while the opportunities come from the fact that they are possible.