# How to Implement AND Function using McCulloch Pitts Neuron?

Firstly, to implement AND function using McCulloch Pitts Neuron you must have some knowledge about McCulloch Pitts Neuron. But, if you don’t know what is McCulloch Pitts Neuron, don’t worry, I’ve already discussed it in this blog posts “What is McCulloch Pitts neuron?“.

So, first of all, we have to draw the truth table of AND function. Therefore, In AND function, the Output will be High or 1, if both the inputs are High.

## Truth Table of AND Function

x1 | x2 | Y |

1 | 1 | 1 |

1 | 0 | 0 |

0 | 1 | 0 |

0 | 0 | 0 |

After that, we have to assume two weights w1 = w2 = 1 for the inputs.

## Calculating Net Input

After that, we have to calculate the Net input, to calculate the net input we have a formula:

So, based on that above formula we are going to calculate the Net input for all the neurons.

x1 | w1 | x2 | w2 | y_{in} | Y |

1 | 1 | 1 | 1 | 2 | 1 |

1 | 1 | 0 | 1 | 1 | 0 |

0 | 1 | 1 | 1 | 1 | 0 |

0 | 1 | 0 | 1 | 0 | 0 |

For example for the first input (1, 1) the net input will be, yin = 1*1 + 1*1 = 2. Similarly, we have to calculate the rest of the inputs.

So now the question is when the neuron will fire? therefore, It is only possible if we know the threshold value. Therefore, we need to know the threshold value, after that, it will decide which neuron will fire and which will not.

## Calculating Threshold Value

Θ ≥ nw – p

n = number of inputs, w = positive weights, p = negative weights.

For example, here, n = 2, w = 1, p = 0

So, the threshold value (Θ) will be Θ ≥ 2×1-1, Θ ≥ 2.

## Defining the Activation Function

So, the activation function using threshold value will be look like this:

In short, the threshold Value is greater than or eqaual to 2.

## Watch this tutorial on YouTube

In conclusion, watch this tutorial – AND function using McCulloch Pitts Neuron, easiest explanation, easy to implement on exams.