# How to find the intersection points of two 3D surfaces in Mathematica?

I have two equations consisting of two variables and I'm plotting those two functions in 3D by defining the range of the two variables. I need to find the points of intersection of these two functions. I tried using Graphics'Mesh'FindIntersections but its not working for 3D plots. Can anyone help me with this? I need to get the data of the intersection points.

The code is as follows:

e1= -0.0492101+(0.00982664*l3*Sec[147.557*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.00982664*l8*Sec[147.557*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139*l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8])==0;
e2= 0.00629091 +(0.113333*l3*Sec[152.139*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.113333*l8*Sec[152.139*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139 l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8])==0
plot=Plot3D[{e1,e2}, {l3, 0.008, 0.012}, {l8, 0.008, 0.012}]


I have got a 3D plot as shown here.

Any help is highly appreciated.

• The equation f[l3,l8]==0 can only define a contour in plane. Mar 20, 2021 at 7:30
• The intersection is symmetric about the diagonal line l3==l8. z=Numerator[Together[Rationalize[e1[[1]]-e2[[1]],0]]]; ContourPlot[z==0,{l3,0.008,0.012},{l8,0.008,0.012}] and FindRoot[Simplify[z==0/.l3->.0112],{l8,.0105}] finds an l8 given a good estimate of the location, but I do not trust that. Look at z==0/.l3->.0112 to see why I am skeptical.
– Bill
Mar 20, 2021 at 7:34
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Mar 20, 2021 at 18:15

Perhaps ContourPlot helps to find the intersection points! Try

e1= -0.0492101+(0.00982664*l3*Sec[147.557*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.00982664*l8*Sec[147.557*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139*l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8]) ;

e2= 0.00629091 +(0.113333*l3*Sec[152.139*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.113333*l8*Sec[152.139*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139 l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8]);

plot = ContourPlot[
e1 == e2  , {l3, 0.008, 0.012}, {l8, 0.008, 0.012},
MaxRecursion -> 4, PlotPoints -> 50 ] // Quiet


intersectionpoints=plot[[1]] [[1]][[1]]
(*{{0.008, 0.0106924}, {0.00800158, 0.0106923}, {0.00800352,0.0106923}, {0.0080051, 0.0106923},...}*)

• Here are several other solutions: $$[[\mathit{l3} = - 0.928876965234335, \mathit{l8} = 0.322423141027989] , [\mathit{l3} = 2.97284035794540, \mathit{l8} = 0.311944493392789] , [\mathit{l3} = - 21.6616722319277, \mathit{l8} = - 8.27489640495406] , [\mathit{l3} = - 55.0458668808167, \mathit{l8} = 30.2464029070779]]$$ Mar 20, 2021 at 14:19
• @user64494 Might be, I restricted the solution range to the range OP asked for! Mar 20, 2021 at 15:40
• Thank you so much. How can I substitute those (intersectionpoints) values back into the equations? And also I want to substitute all these points into another two expressions. I can use ReplaceAll by using /. {l3-> ,l8-> } but how to represent each point respectively in that case? Mar 22, 2021 at 4:59
• Try Map["expression" /. {l3->#[[1]],l8->#[[2]]}&,intersectionpoints] Mar 22, 2021 at 7:07
• Perhaps it's clever to Interpolate every branch of the intersectionpoints... Mar 22, 2021 at 7:10