Being defensive in these two planes is actually pretty complicated, compared to many other rides.
Assuming you are referring to a plane that is basically saddled up on you:
The hog's unparalleled flaps and rudder really give it some options but take quite a long time to really become proficient in. Sax gives good advice but I don't think there is any way to really get the question answered in text. Fortunately for you Cipher, there are several dedicated hog drivers who are straight up killers. Most of these guys are also very willing to help a new stick.
Being defensive in a 51 leaves you with limited options, as they relate strictly to plane performance. In a 51, beyond pointing the nose down and hoping to outrun the guy, you are gonna have to be experienced enough to "do some of that pilot chit" to effectively scrub someone(anyone with even a little skill) off your 6.
Unfortunately, there are lots of 51 pilots but very few good ones. The 51 attracts a lot of noobs due to it's proliferation in WWII and it's speed. The downside to this is that many noobs get in the pony and fly it so timidly that they can never manage to get more than 2 or 3 kills an hour, and they never actually get in any good fights which is where the most fun is to be had. They bushwhack and then run away at 500 MPH, never really improving their skills. Please don't be one of these, there's more than enough of them already.
Also, take each snippet of advice with a grain of salt. For instance this paragraph will get you killed if you are defensive( a plane close aboard your 6):
Good tactic in many planes, if you put full flaps out and start to turn up into a very high climb and keep circiling the person on your 6 will loose E behind and below you and now be able to get a gun solution on you. All you have to do is keep it up until the other planes stalls. When he stalls all you have to do is go full rudder and roll your plane over on him throwing you on his 6. Works well with the Spitfires
This is a spiral rope and is an offensive maneuver. With a bad guy near to a solution on your 6, this will quickly get you shot down unless you have significantly more E, but then if you do, you really aren't defensive in the first place which is what this thread is about. This is a new person trying to help, but giving very bad advice.
Happy hunting!