Pattern matching, the ability to recognize and maximally respond to an input pattern that is similar to a previously learned pattern, is an essential step in any learning process. To investigate the properties of pattern matching in biological neurons, and in particular the role of a calcium-dependent potassium conductance, a circuit model of a small area of dendritic membrane with a number of dendritic spines is developed. Circuit model simulations show that dendritic membrane depolarization is greater in response to a previously learned pattern of synaptic inputs than in response to a novel pattern of synaptic inputs. These simulations, in combination with an analysis of the circuit model equations, reveal that when a synaptic input pattern is similar to the learned pattern of synaptic inputs, the total dendritic depolarization is a linear combination of dendritic depolarization contributed by individual spines. When at least one synaptic input differs markedly from the learned value, dendritic depolarization is at nonlinear combination of individual spine depolarizations. These principles of spine interactions are captured in a computationally simple set of 'similarity measure' equations which are shown to reproduce the response surface of the circuit model output. Thus, these similarity measure equations not only describe a biologically plausible model of pattern matching, they also satisfy computational requirements for use in artificial neural networks.