Derailler clearance on ERTO 406 wheels i have a Cannondale Hooligan I on which I plan to remove the Shimano Nexus 3spd IGH and replace it with a derailleur gear system. This bike has ETRTO 406 aka 20 inch wheels.

I want to use an 11 speed XTR M9000 medium cage RD

My question is: what is the maximum number of teeth I can have on the cassette? I see there is a 11-46 or 11-42 and 11-40.

The question isn't about the capacity of the derailleur but about whether there will be enough clearance between the derailleur and the ground.

thanks!
Rough estimate of distance of tip of derailleur cage from axle center:

I assume top pulley wheel is just touching sprocket, and pulley centers lie on a radius line from wheel axle center.

The radius through chain pin centers of a sprocket is approximated by n * s / 2 pi. n is number of teeth, s is chain pitch: 12.75mm in this case (see here).

Add say 5mm to pin center radius to get approximate total radius of sprocket.

40 teeth: 86mm

42 teeth: 90mm

46 teeth: 98mm

XTR RD-M9000 derailleurs have 11 tooth pulleys (I think)

11 teeth: 27mm

The distance of the tip of the lower pulley wheel from the wheel axle center is sprocket radius + (2 * pulley radius) + cage pulley center to pulley center distance.

Guessing the pulley center to pulley center distance is 80mm:

40 teeth: 220mm

42 teeth: 224mm

46 teeth: 232mm

How much clearance between the axle center and road do you have? An ETRTO 406 rim is obviously 203mm radius, plus say 25mm tire depth for a 35mm wide tire: 228mm. 

There are plenty of 20" wheel folding bikes with derailleurs available, but I assume these use ~30 tooth largest sprockets. Browsing through google images of folding bikes I see their derailleur cages are very close to the ground anyway.