I think I fundamentally misunderstand the "Destiny Knot".
If I have a 31/31/xx/31/31/31 male and a 31/31/31/31/xx/31 female, what are the chances the baby will have 5 perfect IVs?
What are the chances the baby will be hex flawless?
Can "Destiny Knot" choose to pass on the Attack stat of both parents (i.e. only three other stats would be passed from the parents)? Or if "Destiny Knot" chooses the Attack from one parent, does it disqualify the Attack of the other parent?
I don't know the how to calculate the chances given the parents you wrote there but about your question about hex flawless. If both parents have 5 perfect IVs in the same stats there will be a 1 in 6 chance that the baby will have the same IVs as them. For example:
Male: 31/31/31/31/31/x and female: 31/31/31/31/31/x
Both being perfect except for speed. Destiny Bond
passes an IV from 5 of the 6 stats. If it chooses HP let's say, in this example, it would then choose
either the IV from the mother
or the father. Since both in this example have perfect HP IVs, the baby will be guaranteed the 31 in HP. The 6th IV (that is not chosen by Destiny Knot) will be generated at random. Since the parents have 5 perfect IVs in the same stats and the Destiny Knot chooses 5 out of the 6 stats to get the IVs from, one of the IVs will be random (so six stats means the chance of the baby being the same in this example is 1 out of 6). Now, because 1 IV is generated randomly
always, if you breed two hex flawless pokemon, there will always be a a possibilty that the baby comes out with a non perfect number in that IV. Because IVs range from 0 to 31, it should be a 1 in 32 chance that the baby's 6th IV that was generated randomly will be 31.
If the parents are hex flawless, you at least have a guarantee that at least 5 IVs will be perfect because no matter which IV is randomly generated, the 5 others will be perfect from the parents. If like in my example, the parents are perfect in the same 5 IVs, you have the 1 in 6 possibility of having the same IVs on the baby like I mentioned. Still, Destiny Knot might pick the imperfect IV (5 in 6 chance) which in my example would be the speed. That would make the baby potentially have only 4 perfect IVs. (One of the IVs that wasn't perfect was passed by Destiny Knot and one of the perfect ones was randomly generated as a number other than 31)
If the parents have imperfect IVs in different stats like in your example, the chances of the baby having perfect IVs in the 5 stats you desire decrease. In your example, Sp Def might be picked but then the parent chosen to pass the IV is the mother which is X. Then if defense is also one of the 5 IVs passed by Destiny Knot, there's another 50/50 chance of the father being selected. If it is, you end up with a baby with x in defense and special defense. And
theeeen, that means one of the other stats would be the randomly generated one, giving you that 1 in 32 chance of it being perfect. If it's not an IV the baby needs for its use (like special attack on a purely physical attacker) then that random IV wouldn't be an issue but if the random one
is needed (like HP in most Pokemon) and it isn't perfect, you wind up with a baby with only 3 perfect IVs.