# Strassen’s Matrix Multiplication

1. Input the rows and columns of both the elements
2. Check if the number of columns of first matrix is same as the rows of second matrix(condition for matrix multiplication).
3. Use the Strassen’s formulae.
4. Keep values in the final matrix.
5. Next, display the final matrix.
`#include<iostream>   using namespace std;double A;        #input the A and B matricesdouble B;void insert(double a){	double val;	for(int i=0;i<4;i++)	{		for(int j=0;j<4;j++)		{			cin>>val;			a[i][j]=val;		}	}}double cal11(double a){	return (a * a)+ (a * a);}double cal21(double a){	return (a * a)+ (a * a);}double cal12(double a){	return (a * a)+ (a * a);}double cal22(double a){	return (a * a)+ (a * a);}int main(){	double a11,a12,a22,a21,b11,b12,b21,b22,a,b;	double p,q,r,s,t,u,v,c11,c12,c21,c22;	cout<<"\n a: \n";	insert(a);	cout<<"\n b: \n";	insert(b);		a11=cal11(a);	a12=cal12(a);	a21=cal21(a);	a22=cal22(a);	b11=cal11(b);	b12=cal12(b);	b21=cal21(b);	b22=cal22(b);   	p=(a11+a22)*(b11+b22);	q=(a21+a22)*b11;	r=a11*(b12-b22);	s=a22*(b21-b11);	t=(a11+a12)*b22;	u=(a11-a21)*(b11+b12);	v=(a12-a22)*(b21+b22);cout<<"\n final matrix"; 	cout<<"\n"<<p+s-t+v<<" "<<r+t;	cout<<"\n"<<q+s<<" "<<p+r-q+u;    return 0;}`

--

--