reference voltage suggestion

i am using LM311 in my project ..my vin for it varies from 0 to 24 Volt ..i have to set my reference voltage to 21 v ..i have 9v battery to power the arduino can i use the same supply by adding a boost converter

Yes but it will not last very long if it is one of those smoke alarm batteries they are all but useless.