We build the equation the way a decoder does: each input is ANDed with the minterm of the selects that "point at" it", and all these products are ORed.
Y=k=0∑2n−1mkIk
where mk is the minterm of the select variables corresponding to k. This sum-of-products is literally a decoder (the minterms) feeding AND–OR logic.
Trick (Shannon expansion): to build an n-variable function with a smaller2n−1:1 MUX, put n−1 variables on selects; each data input becomes one of {0,1,v,vˉ} of the leftover variable v.
Real MUX chips add an enableE. Typically Y=E⋅(MUX expression) (active-high), so E=0 forces Y=0 (or high-Z on tri-state parts). Enable lets you cascade and tri-state onto a shared bus.
Imagine 4 water pipes and one tap that can drink from only one pipe at a time. You turn a little dial with 2 clicks (that's 2 select bits = 4 positions). Whatever number the dial shows, that pipe's water comes out. The MUX is that magic tap for electricity — it copies just ONE chosen input to the single output wire, ignoring the rest.
Dekho, multiplexer ek digital switch hai — bahut saare inputs aate hain, lekin output sirf ek. Kaunsa input output pe jayega, ye decide karti hain select lines. Jaise ek rotary knob hota hai: knob ki position number batati hai, aur us number wala input bahar aa jata hai. Isiliye 2:1 MUX me 1 select line hoti hai (2 positions), 4:1 me 2 select lines (4 positions), aur general n select lines se 2n inputs address hote hain. Yaad rakhna: number of select lines =log2(inputs), na ki inputs ke barabar.
Equation banane ka logic simple hai: har input ko us select combination ke minterm se AND karo jo us input ko point karta hai, phir sab ko OR kar do. Isiliye 2:1 ke liye Y=SˉI0+SI1. Jab S=0, sirf SˉI0 bachta hai, baaki 0 ho jate hain — clean selection. Yehi wajah hai ki kabhi do inputs leak nahi karte: kisi bhi select value pe exactly ek hi minterm 1 hota hai.
Sabse powerful baat — ek 2n:1 MUX se koi bhi Boolean function ban sakta hai. Variables ko select pe lagao, aur har data input pe uss truth-table row ka answer (0 ya 1) daal do. MUX automatically sahi row select kar leta hai. Aur agar chota MUX use karna ho, to Shannon expansion se ek variable ko baahar factor karke inputs ko 0,1,v,vˉ me convert kar sakte ho. Exam me ye trick bahut marks deti hai, isliye XOR wala example zaroor practice karo.