How many resistors is enough?
Mar 25, 2005 at 8:20 AM Thread Starter

#### Clutz

##### Tells us when we're offset.
Syzygies posted an interesting question in the M3 discussion thread. It caught my attention and I wanted to respond to it, but since it seemed like it was way off topic I made a new thread. The question was essentially, how many resistors (feel free to replace resistors with any electrical bit) does one need to have in their inventory in order to be able to have perfect matching in those parts.. i.e. HOw many 47kOhm resistors does someone need in order to have two of them which are identical to each other, given some maximum % difference we're willing to live with? Syzgies noted that this was a problem similar to the birthday problem, and was entirely correct. For the sake of completeness, I include my initial reply to his post about the Birthday Problem, and then follow on to the more interesting question.

Quote:

 Originally Posted by Syzygies There's a famous math problem behind resistor matching: The "Birthday" problem. With 30 people in a room there's likely to be two people with the same birthday. Buy a bag of twenty resistors, there's likely to be an amazing match among two of them.

Ahh yes the birthday problem, I really like probability theory (and stochastic processes) and this is a really cool bar trick too.

The birthday problem essentially asks, what is the probability that in a group of size N, what is the probability that at least 2 individuals will have the same birthday? The probability is the 365-1/(365) * (365-2)/(365) * (365-3)/365 * .... (365-N+1)/365. (I can explain why this works to anyone who is interested). There is an easy to use equation for this problem which involves using factorials, and it is 365!/((365-N)!*365^N). (Don't bother trying to calculate 365! - I do not know of any calculator that can do it (not icluding software like Mathematica, Matlab, Maple, etc..).. For those who are curious, it's about 2.5*10^616 (about 615 zeros following 25).

Quote:

 Originally Posted by Syzygies A more interesting question is what one's high/low inventory levels should be, to always find good enough matches from what's left after years of cherry-picking and restocking.

I may be totally wrong about this- I'm not a statistician or a mathematician- but I think what I say below is correct.

That's a relatively easy problem to solve too (with a few assumptions which are probably not met in the instances you described). You modify the above function to be R!/((R-N!)*R^N), where R is the number of different possible classes of resistors of a particular rating and N is the number of resistors in your collection.

There are two problems with this. The first problem, and it's one you cannot get around - is that it assumes you have a random sample of resistors that can all be called a particular class. e.g. You have not already started taking some resistors out of your collection and started matching them. Once you do this, your sample is no longer random and this approach will no longer work perfectly. In reality, if you have a large enough number of resistors (and I do not know how many resistors is enough)- it probably does't matter TOO much- but the fewer resistors you have, the more it will matter.

The second issue comes in two parts. The first is - how precisely do you wish to have your matches be? Is a 0.1% difference considered identical? 0.01%? That's entirely a decision that has to be left up to the individual. The reason this is important, is that we are going "bin" together resistors that are close enough that we're willing to call them identical.
i.e. is a 47.01kOhm resistor similar enough to a 47.02kOhm resistor to call them identical, but a 47.01kOhm and 47.03kOhm are too different? In this case our "bin" sizes are 0.2kOhm each.

To address this problem we'd need to know the distribution of variance around resistor values produced to have a given resistance. We could probably assume (probably a reasonable assumption) the "error" is normally distributed, in which case we would just need to know what the variance in this is.

We need to do these two things so we can determine the value for R. Once we have R, we can determine how many resistors we need (N) to have 95% (or whatever % you desire) chance of finding two that are identical.

All in all, a very soluable problem - and perhaps one that is interesting enough to get a measure on the variance. I (think) can work out this problem to work for a given amount of variance and precision. It shouldn't be too hard- but I'm not going to bother unless people care.
Cheers,
Clutz

Mar 25, 2005 at 8:50 AM
Quote:

 Originally Posted by Clutz It shouldn't be too hard- but I'm not going to bother unless people care. Cheers, Clutz

Clutz, by all means, please bother. I care.

(Just being funny, but seriously I'd appreciate your thoughts. I'm sure there are some rules of thumb in the archives somewhere, perhaps even "the formula", but it'd be fun to watch you work this out.)

Mar 25, 2005 at 12:39 PM
Quote:

 Originally Posted by Clutz The second issue comes in two parts. The first is - how precisely do you wish to have your matches be? Is a 0.1% difference considered identical? 0.01%? That's entirely a decision that has to be left up to the individual.

There is no simple answer to this that would apply to all resistors used in an amp. Some resistors in the circuit can be varied over a wide range without audible or measured effect, whereas others would have to be quite closely matched (either between "sides" of a differential or complementary pair within a channel, or between channels).

I'll illustrate this with some resistors in the M³ amp. The feedback resistors R4 and R3 determine the voltage gain of the amp, you want these to be reasonably well matched between the two channels for obvious reasons. However, the need here is to match between the channels, not necessarily for each to be within 0.1% of the rated value. If, for example, R4 (which is supposed to be a 10K ohm resistor) actually measured 10.2K in one channel, and you pick another 10.2K resistor for the other channel, then it's good enough. Now look at the R7 resistor, since it is in series with a pot, it is not critical that it's within 1% of 7.5K because the pot adjustment will make that level of accuracy rather moot. Also, it is not necessary to match this resistor between channels.

There are places where adherence to a very close tolerance is required. For example, in a phono preamp, the resistors and capacitors that form the RIAA equalization response curve filter must be very accurate. However, this sort of thing is rarely needed in a headphone amp. We use 1% metal film resistors here more for their consistency, low noise, and stable temp coefficient than their accuracy.

Mar 25, 2005 at 2:45 PM
We all use our judgement for when to match what how well, making guesses to the kinds of issues amb understands and addressed. Having made these judgments, and committed to this hobby so we don't mind building up some inventory on basics like resistors, what constitutes a rational inventory?

In my limited experience, such an inventory can be quite small. This surprise reminded me of the birthday problem. However, as Clutz noted, one won't stay so lucky after some cherry-picking and restocking. This is the effect I'd like to have a rough intuition for at parts ordering time. The exact formula is of academic interest, though I'm an academic, and I'm interested.

The one piece of math I've worked on in this area is the one piece of math that would have thrilled me as a kid, when I had no idea what mathematicians did. With the mathematician/magician Persi Diaconis, we solved in closed form how ordinary human riffle shuffling of a deck of cards works. This enabled us to back up our claims that people don't shuffle enough, and lead to the "shuffle seven times" rule of thumb.

There, computer simulation was crucial. We were just playing for each other's benefit, I was up in the middle of the night writing a program to figure the odds of success for a card trick where the magician lets an audience member shuffle three times and move the card, then the magician guesses the card. Persi wanted to see the numbers after giving the magician two guesses, modeling the fact that they're very good con artists, effectively working with two guesses instead of one. I made the change, decided to also run the simulations with 26 guesses, and we saw a factor of two decay in the magician's edge over even odds, for each additional shuffle as the number of shuffles went to infinity. This was a crucial clue which lead us to understand the theory.

For this "match with replacement" problem, I'd be satisfied with some computer simulation tables showing how well one can expect to do with different inventory sizes. Some of us would glance at the table and go away with improved intuition for the next time we order key parts. Others would have a clue what the right answer to the theoretical question must look like.

Mar 25, 2005 at 3:07 PM
They problem I see with mathematical models for component matching is that they make assumptions about the distribution of values that may not be true in practice. If you buy a bag of resistors the distribution of values is likely to be influenced by the vendors manufacturing and selection process in a way that's hard to predict. If you buy a bag of 1K resistors and measure them, will you get a gaussian distribution about 1K? I suspect not. Someone has probably looked into this, there is probably data in the literature. It would be interesting to have a look.

Mar 25, 2005 at 3:29 PM
I was going to ask for people's hunches on this.

My intuition is that any realistic model for the distribution within a 1% or 5% range will give surprisingly similar answers in simulation. I'd do the simulations for various models:

Normal distribution
Uniform distribution
Mean picked at random for the entire new batch, tight normal around this mean

or any others people suggest. My point is that the recommendations that come out of simulation won't be sensitive to the particular model, to within a factor of two. And no one's going to remember the recs any closer than a factor of two. This is like working with dB.

Mar 25, 2005 at 4:34 PM
Lets put this in perspective. We are not talking about high Q filters, reference ladders for data converters, etc. If headphone amplifiers were so sensitve to component matching, there would be far fewer success stories around here. IMO, this is a being made into a much bigger deal than it really is. There are only (perhaps) a couple places be bothered about in the PPA, MMM, Pimeta, etc. (The Gilmore dynaX are a slightly different story.) Since this is an audiophile site, I understand that it is natural to obcess. It's just not worth it here though.

1. Do you care about absolute value?
2. Do you care about relative value?
3. Would a slightly different value change the circuit behavior? - If so, is is enough to care about?

My suggestion is to just buy 0.1% or better resitors and be done with it if you think it's that important. Your DMM probably isn't good enough for precise matching anyway.

Mar 25, 2005 at 6:12 PM
Sorry! I was busy matching my cheapie resistors for a cost-effective MINT for friends, and noticed this effect. I'm a mathematician, I thought it was a great problem. I go through life with some intuition as to how any problem like this works, it puts life in an entirely different perspective. I can't drive through a block of traffic without seeing the game. (Don't worry, I impose a very high penalty for lane changes, which are generally counter-productive anyhow, I want my guesses to be right the first time, not make other drivers pay for my crappy guesses like most hyperactive drivers out there...)

It's far more practical not to worry about such problems. It's also far more practical to pay someone else to build amps.

Mar 25, 2005 at 6:26 PM
Of course it isn't a necessity to match resistors for most places in headamp circuits, but there's no harm in trying..

Mar 25, 2005 at 8:19 PM
No need to be sorry. It certianly does no harm to match all the resistors. The point I was trying to make is that for most of the resistors, there is little to no upside...other than the satisfaction of knowing that your amp has great matching with a job well done. Perhpas I've underestimated this aspect.

Incidentally - On chip, fabs typically specify components as x% relative matching for a given size. They (generally) mean 3 sigma in a normal distrubution. Absolute values can vary as much as ~15% though.

Mar 26, 2005 at 1:14 AM
Quote:

 how many resistors does one need to have in their inventory in order to be able to have perfect matching in those parts..

I wrote a text-interface (i.e. command line) Monte Carlo simulator to model this problem a few years ago. Full source code is included in the zip file, as are Makefiles for Windows and Linux. You could port it to OS X trivially. Yes, I'm talking to you, Syzygies.

Full details of my findings are in the post on Headwize where I announced them, if anyone's interested. The bottom line is, to match 1% components to 0.1%, you only need about 4 parts, on average. Play with the simulator to get full details.

The program assumes a rectangular distribution. More on this below.

Quote:

 They problem I see with mathematical models for component matching is that they make assumptions about the distribution of values that may not be true in practice.

Indeed. For Vishay RN55s (the only resistors I have extensive experience with), the even powers of 10 values tend to have very tight tolerances around the nominal value. It's not uncommon to pull a whole series of 1Ks out of the drawer (such as for a PPA, which needs a lot of 1Ks) and have better than .1% matching on all of them. Matching is gets worse as you go to in-between values: 2.2K is pretty good, but 3.32K is probably theoretically bad: it's common to require at least 4 tries to get an 0.1% or better match. 4.7K might actually be better, but I don't use many of those, so I'm speculating here.

Another resistor line may well behave differently. I can't even speculate properly here.

Quote:

 the satisfaction of knowing that your amp has great matching with a job well done. Perhpas I've underestimated this aspect.

High end audio is fraught with such soul-wrenching fiddlyness that it's very soothing to know that you've already ruled out a potential source of problems when you hear something "off" in the recording.

Mar 26, 2005 at 2:35 AM
environmental variation may toss a monkey wrench into to your enjoyment of obsessively hand matched components if you let yourself think about it - do you cal your head amp yearly?

soldering can change R value, probably a bigger concern with diyers without "production" hand soldering experience

then aging/stress relief and oxidation/corrosion will cause a drift in values over time

many circuits do have good stability over time - in "shirt sleeves" environment, most parts must be more or less following a common trend in environmental changes but the reason for so many expensive resistor types is to GUARANTEE long term stability in more challenging environments

Mar 26, 2005 at 5:11 AM
jcx:

assuming that one resistor of a matched pair is not dammaged and the other remains "fine" (you hold your uberhot iron on the leads of 1 for a solid 20 seconds, and just the bare minimum necessary time on the other of the pair) dont they both age at the same rate after that? wouldnt any "ill effects" from say excessive power disipation, oxidation, or break in effect both nearly equally after they were installed?

maybee one would suffer more than the other under certain circumstances (loud tones on 1 chanel, but not other) but most people who are going to go to the trouble of matching resistors will not even come close to their rated power value except by extreme accident. so the "aging" that may take place here is likely verry little.

now, for the issue of the likelyhood of pulling a pair of verrry closley matched resistors at random: if the tollerances are not way worse than what you expect (say expecting a 0.1% pair from 10% resistors... this is unrealistic) you are several times more likely to get a set that is within +-15%*tollerance of the average value than the other +-35%*tolerance of the average value. just how distribution generally works. weather the average value is the rated value or not depends...

i tsted 10 vishay/dale resistors to match a pair for an amp , all were the same value +-0.2ohm on 47.5ohm resistors. they were all slighlty off of rated value (probably meter error) but that is a small mater. i was more conceerned with similar parts than the actual values here.

the generic "blue" 1% resistors did not fare as well in my pseudo scientific tests for similarity... i did find similar measured value parts, but they varried more as a group.