Friday, October 02, 2026
Interesting math solution
Thursday, May 15, 2025
Intersection of circle and sine wave
The equation of the circle with center (1, 1) and radius 2 is: (x - 1)² + (y - 1)² = 4
At any intersection point, the coordinates (x, y) must satisfy both equations:
1. (x - 1)² + (y - 1)² = 4
2. y = sin(x)
Let's substitute the second equation into the first: (x - 1)² + (sin(x) - 1)² = 4
This is a transcendental equation and cannot be solved analytically. Luckily, the equations are easy to plot by hand. The circle is trivial and plotting sin(x) only requires you to know that sin(0)=0, sin(pi/2)=1, sin(2*pi)=0. The sine wave amplitude is between -1 and 1. Since the circle has radius 2 and is centered at (1, 1), both the x and y interval for the circle will be [-1, 3]. This results in two intersections. Using Desmos for a cleaner plot:
Note that if we increase the amplitude of the sine wave, we will can have more than 2 intersections. For an amplitude of 3.5, we have 4 intersections:After amplitude, if we also increase the frequency by 4, we get even more intersections:It is only reasonable to find the number of intersections by hand drawing if the sine wave is of the simple form sin(x).
If you want to find the numerical values of the intersections (which is not asked for in the question), you have to use numerical root finding methods like Newton-Raphson.
Saturday, February 15, 2025
Hexagon proofs
- a1+a2+a3+a4
- b1
- c1+b2
- c2+b3
- c3+b4
- c4
Note that the sum of internal angles of the hexagon are (z+x)+(y+z)+(x+y)+(z+x)+(y+z)+(x+y) = 4*(x+y+z). Since x+y+z=180°, this is another way to prove that the sum of internal angles are 4*180° = 720°. Also note that this proof is only valid for a regular hexagon. For a non regular hexagon, the sides would not be parallel and we would not be able to assert the equality of angles of triangles. The first proof at the top is valid even for a non-regular hexagon.
Since all triangles have the same 3 internal angles (x, y, z), they are similar. Since they also have a side of length "a", they must be congruent. Since the side "a" is opposite to angle x in one triangle and opposite to y and z angles in the others, the angles must be the same, x = y = z, which can only happen if they are all 60°. Therefore, the triangles must be equilateral:Friday, March 29, 2024
Matematik'te ezber yerine mantık yürütme
Oğluma soruları mümkün olduğunca kural ezberleyerek değil, mantık yürüterek çözmemiz gerektiğini hatırlattım ve şu yolu izledim:
- A merkezli ve 16cm yarıçaplı bir çember çizersek bu çember C'den geçen ışını iki noktada (B ve D) keser.
- 16cm AC'den (14cm) fazla olduğundan ikinci kesişim C köşesinin üst kısmında kalır (D noktası).
- Sorudaki üçgenin oluşabilmesi için çember kesişimi C'nin altında olmalıdır (B). O da ancak bir nokta olabileceğinden üçüncü kartın BC=16cm çıkması durumunda dahi tek üçgen oluşur.
- Cevap çözüm videosundaki 3/4 seçeneği değil, 4/4 = 1 seçeneği olmalıdır.
AB verildiğinde C noktasının altında iki kesişim, yani iki üçgen olasılığı ancak AB'nin AC'den az ve BC kenarına ait yükseklikten (h) fazla olması durumunda mümkün, bkz. aşağıdaki B1 ve B2 noktaları. AB uzunluğu yükseklikten de az olursa kesişim olmayacağından üçgen oluşmaz. AB yüksekliğe eşit olursa yine tek üçgen oluşur.
Friday, July 03, 2020
Probability of at least one failure
The longer way is to find all unique failure combinations and their probabilities and sum them up because any of those combinations will satisfy "at least one failure" criteria. Pass probability = 1-0.1 = 0.9. Since fail order is not important, we can use combinations:
- Failure combinations: abc, a (b and c pass), b (a and c pass), c (a and b pass), ab (c pass), ac (b pass), bc (a pass)
- Probabilities: 0.1^3, 0.1*0.9^2, 0.1*0.9^2, 0.1*0.9^2, 0.1^2*0.9, 0.1^2*0.9, 0.1^2*0.9
- At least one failing: abc OR a OR b OR c OR ab OR ac OR bc. In probability, OR is summation, AND is multiplication.
- Sum: 0.1^3 + 3*0.1*0.9^2 + 3*0.1^2*0.9 = 0.271
- Check with short solution: 1-(1-p)^n = 1-(1-0.1)^3 = 0.271
- P(At least 1 fail) = C(3,1)*p*(1-p)^2 + C(3,2)*p^2*(1-p) + C(3,3)*p^3
- k=1..n, sum(C(n,k)*p^k*(1-p)^(n-k))
- Binomial Theorem: k=0..n, sum(C(n,k) * x^k * y^(n-k)) = (x+y)^n
- If we use x = p and y = 1-p, we get k=0..n, sum(C(n,k) * p^k * (1-p)^(n-k)) = (p+1-p)^n = 1. The reason that this summation is one is that it represents all possible combinations and sum of probability of all combinations (including no failure case) is 1.
- In our case k starts from 1, because. we don’t consider the empty set, i.e. no failure case. Probability of k=0 (no failure) case: C(n,0) * p^0 * (1-p)^(n-0) = (1-p)^n.
- Subtract k=0 case: k=1..n, sum(C(n,k) * p^k * (1-p)^(n-k)) - (1-p)^n = 1-(1-p)^n, which is equal to the short solution at the beginning of this post.
Tuesday, March 17, 2020
Applied Mathematics
- Trigonometry (sine, cosine)
- Quadratic equations
- Vectors in 3D, derivative of vectors in rotating reference frames
- Linear algebra. Cross product, dot product. Matrix multiplication: Used in rotating objects in 3D
- Basic integral
- Basic derivative
- Differential equations (2nd order ODE)
- Taylor Series (for linearization and as a starting point of numerical integration)
- Interpolation
- Gaussian distribution. Regression. Bayes' Theorem. Markov Chain. Kalman Filter
- Fourier Transform
Wednesday, December 25, 2019
Lessons from teaching my kid math for 10 months with Khan Academy
During our problem solving sessions, I saw again and again that my son had no problem with the subject matter but was usually missing a bit and getting the answer wrong. When I helped him just a little by telling him to be more careful, he was able to solve most of the problems.
I suspect many students who are bad at math struggle due to a lack of attention. Unfortunately, improving attention requires one on one care, which the education system cannot provide. Parents have to help their kids.
Other lessons learnt:
- It is frustrating to witness that your child forgets the math rule you explained a minute ago. Be patient and repeat as much as necessary.
- Only advance to the next subject when your child can solve all of the end of chapter questions without any assistance from you. You might be dismayed by how many times he might have to repeat that test. As an example, my child solved all 18 questions of Understanding Decimals unit test in one sitting on his 13th try. It took him almost two weeks of frustration and tears! This sharpened his attention and cured his false sense of self-confidence(!)
- Every couple of months, revisit older subjects by re-solving their unit tests.
- My son is impatient and wants to solve problems quickly in his head. This works for simple operations but once you get to problems involving multiple steps like 12*17, you have to force him to use pencil and paper and show each step clearly to you.
- Since every child is different (and also rapidly changes with time), progress and tactics will be different. You have to constantly observe and adapt to the learning/teaching challenges you and your child will face.
- Persistence is key and the hardest part. It is easy to teach a couple of times, but most parents struggle to do it consistently.
Music: Chumbawamba - Tubthumping
Tuesday, March 05, 2019
Teaching English and mathematics to a six year old
Since both Duolingo and Khan Academy have curriculums that progress according to his level, I don't have to think about what to teach when. Khan Academy videos show me how to explain mathematical concepts to a child. Duolingo, besides training his English, also improves his reading and comprehension skills. Using the English version of Khan Academy also supports the language effort (of course, I have to translate math questions that have too many words in them to Turkish). The exercises show him the importance of paying attention to detail before jumping to conclusions, i.e. conscientiousness. Doing something every day is helpful in forming the most useful habit in life: persistence. And finally, he got rid of fearing failure and started to treat failure as a learning opportunity.
Friday, July 20, 2018
Solving the Monty Hall problem using Bayesian inference
P(B*) = Probability that Monty will open door B (given that the user has chosen door A) = 1/2
P(C*) = Probability that Monty will open door C (given that the user has chosen door A) = 1/2
P(C*/B) = Probability that Monty will open door C (given that the user has chosen door A and car is behind door B) = 1/1
P(C*/A) = Probability that Monty will open door C (given that the user has chosen door A and car is behind door A) = 1/2
P(B*/C) = Probability that Monty will open door B (given that the user has chosen door A and car is behind door C) = 1/1
P(C/B*) = Probability that the car is behind door C, given that Monty has opened door B = P(B*/C) * P(C) / P(B*) = 1/1 * 1/3 * 1/2 = 2/3
P(A/C*) = Probability that the car is behind door A, given that Monty has opened door C = P(C*/A) * P(A) / P(C*) = 1/2 * 1/3 * 1/2 = 1/3
P(B/C*) = Probability that the car is behind door B, given that Monty has opened door C = P(C*/B) * P(B) / P(C*) = 1/1 * 1/3 * 1/2 = 2/3
As you can see, it is two times better to switch doors, i.e. if Monty has opened door B, switch to door C. If Monty has opened door C, switch to door B. Note that if Monty was truly random, then the probabilities of P(C*/B) and P(B*/C) would not be 1/1 but 1/2 which in turn would cause P(C/B*) and P(B/C*) to be 1/3 and switching doors would make no difference. The probabilities change due to Monty knowing where the car is, i.e. by opening a door, Monty adds non-random information (evidence) into the system and we have to update the initial probabilities which were valid before this information.
Interesting variation of this problem [Think Bayes, p.10]: What if Monty always chooses door B when B does not have a car behind?
Saturday, December 30, 2017
Practical application of the dot product
- Calculate the dot product of the train direction vectors. This is equal to cos(angle).
- If 90 < angle <= 180 (-1 =< cos(angle) < 0), the two trains are moving towards each other
Monday, February 27, 2017
Probability: Difference between "exactly..." and "at least..."
- Exacly 1 head
- At least 1 head
n = 1:16;
pExactly1 = n./2.^n;
plot(n, pExactly1); grid on
hold on
pAtLeast1 = 1-(1-0.5).^n;
plot(n, pAtLeast1)
legend('exactly 1 heads', 'at least 1 heads')
xlabel('n'); ylabel('p')
Note that you can also get probability of at least 1 heads with this sum: pExactly1Head + pExactly2Heads + ... + pExactlyNHeads, wherepExactlyKHeads = nchoosek(n,k) * ph^k * (1-ph)^(n-k)Even simpler: 1 - pExactly0Heads = 1 - nchoosek(n,0) * ph^0 * (1-ph)^(n-0).
For more information, visit Khan Academy.
Thursday, February 11, 2016
Finding the Intersection of Lines
Y = m1*x+n1 = m2*x+n2 --> x = (n2-n1)/(m1-m2)
Consider the following example, which clearly has an intersection at x = 1 and y = 0.5:
The classical equation for line AB results in m1 = infinity and n1 = -infinity, and for CD results in m2 = 0.5, n2 = 0. When you plug these values into x = (n2-n1)/(m1- m2), you get x = (0 - (-infinity)) / (infinity - 0.5) = infinity/infinity = NaN.
You could try to solve this problem using a bunch of if statements to check if a line is vertical, horizontal etc which would be prone to bugs. Or you could use parametric line equations:
Applying the above parametric formula to our example problem, we obtain the following equations:
Line1: P1 = A + (B - A) * t
Line2: P2 = C + (D - C) * u
To find the intersection point we equate P1 to P2:
A + (B - A) * t = C + (D - C) * u.
Using scalar components:
Ax + (Bx-Ax)*t = Cx + (Dx-Cx)*u --> Ax-Cx = (Ax-Bx)*t + (Dx-Cx)*t
Ay + (By-Ay)*t = Cy + (Dy-Cy)*u --> Ay-Cy = (Ay-By)*t + (Dy-Cy)*t
Rearranging into matrix form:
| Ax-Bx, Dx-Cx | |t| = |Ax-Cx|
| Ay-By, Dy-Cy | |u| = |Ay-Cy|
We can solve this M*TU = K system and obtain t and u values: TU = M^-1*K. t and u are -0.25 and 0.5 respectively. Finally to get intersection x,y coordinates, we can use
xIntersect = Ax + (Bx-Ax)*t
yIntersect = Ay + (By-Ay)*t
Which gives us the correct result of (1, 0.5)
An additional benefit of the parametric line equation is that it can easily be extended to three dimensional space. It is also used in calculating intersection lines with a planes.
Lesson learnt: Don't use y = m*x+n, instead use P = A + (B - A) * t
Thursday, August 01, 2013
Math tests
Tuesday, April 03, 2012
Casual Mathematics
Saturday, March 13, 2010
0.999... = 1
0.999... = x
10*0.999... = 9.999... = 10*x = 9 + x --> x = 1
Soru: Bir ampulü takmak için kaç matematikçi gerekir?
Cevap: 0.999...
Wednesday, December 02, 2009
Geometri Maceraları
Sunday, September 27, 2009
Angular Motion and Inertia Tensor

For the rest of the document see pdf (5 pages).
Saturday, September 19, 2009
How to Calculate Euler Angles
Monday, September 07, 2009
Vector vs Scalar Expressions

In this vector form, there are a total of five operations (one derivative, two multiplications, one cross product and one addition)
If we choose to use scalar equations:

Here we have 30 multiplications, 21 subtractions and 3 additions, which add up to 54 operations. As you see, expressing equations in vector form yields 10 times less complication. It is easier to review, find errors and code vector equations. You only need code for vector/matrix multiplication, addition and cross products (they can be easily found on the internet).












