The photo below shows a 3-1/2" trim.
Installation is carried out by first installing the top trim and then the sides. This way you only have one mitre to fit instead of two. If you elect to install the two side jamb trim pieces first then fit the top trim to the sides, you'll have both mitres on the top trim to fit.
Start by measuring the top trim from inside of jamb to inside of jamb and then adding 1/4" to leave a 1/8" reveal between the door jamb edge and the trim or casing. Tack the top trim on and then measure and cut the side jamb pieces. Try the mitres to make sure you have a good tight fit, re-trim if necessary and then once the fit is perfect, glue the joints and nail the trim to the jamb and the rough framing behind the wall finish. Trim is not just for looks it also helps structurally to keep the door frame solid. You can also straighten the jamb between your shims using the trim.
For situations where the door jamb is a little too wide and the trim is flat against the wall, your mitres may be hard to fit and it will be necessary to 'back-cut' your mitres and cut them off the 45 degree mark a little.