Right, the actual math is quite simple. You decide the level of the encounter and multiply the XP award for a standard monster of that level by the number of characters in the party. That is your budget, you can spend it on monsters of different levels and different types (elite, solo, or minion) but their XP awards should total to the calculated budget. That will USUALLY get you an encounter that is fairly balanced and has the difficulty you desire.
Note that there really are a bunch of other elements besides XP budget that will determine the difficulty the players actually experience. Some monsters are just unusually effective for their level. Some combinations of monsters have especially good synergy with each other or leverage weak points in the specific party, like flying monsters vs characters with few ranged attacks. Terrain also plays a part, an artillery monster on a map where none of the party can close with it for instance. These can obviously be interesting challenges, but they can also push an encounter from tough to TPK now and then.
You may also find that the mix of monsters in an encounter will have a lot of impact on how fun it is play out. An elite soldier that is 2 levels higher than the party for instance is almost always going to take a lot of slogging through hit points to kill and usually ends up being a very static sort of fight as the party defender and the elite lock each other down pretty quickly. Strange encounter designs like using 20 archer minions can turn out badly too. Definitely go with a mix of monster types and use higher level elite and solo monsters sparingly.
Avoiding designing maps that promote static 'lock down' type fights is good too. Give the fight plenty of room for maneuvering. Add interesting terrain that drives different tactical options. Add traps, environmental conditions, goals or rewards that don't involve just killing the enemy, pits and bridges, piles of things that can be knocked over, collapsing tunnels, etc. MOST set-piece type fights that lack one or two of these elements will seem to bog down. Unlike most systems 4e doesn't really cater too well to 'trivial' combat encounters. You're often better off to restructure something like "there are some gate guards here and inside are the tough guys you fight after you get past these guys" into a single wave type encounter for example. The weak gate guards can be a couple minions and a single soldier perhaps, but 2-3 rounds into the fight the tougher guys show up and pile on. That way you get one cool encounter instead of 1 that was a waste of time and one that was interesting.