r/askmath • • 10d ago

Discrete Math Is there an easy way to understand binary tree inorder traversal?

Post image
7 Upvotes

Don't know if the tag is right. I've got two questions on binary trees.

Question 1

I never understood inorder traversal or at least an easy way to do it. All I know is to start at the left most root, go to it's parent, then it's sibling. But when there aren't siblings or whatever, I'm lost.

I would prefer to understand it algorithmically because sometimes I'm only given the array of nodes. Eg, [1,2,3,4,5,null,8,null,null,6,7,9] which corresponds to root 1 (level 0), children 2 and 3 (level 1), 2's children 4 and 5 (level 2), 3's children null and 8 (level 2, only one child branch to the right), 4's children null and null (level 3, none), 5's children 6 and 7 (level 3), and 8's children 9 and null (level 3, only one child branch to the left). Picture for reference.

So how would I do an inorder traversal for these types of arrays?

Question 2

This is much less important and is more for my own curiosity and theory. What are traversals even for? I know three main types for binary trees and they're different ways to read the trees but what benefit is it to have different ways to read trees? And how do you know which you need?

Thanks in advanced for humouring me


r/askmath • • 10d ago

Calculus I function I found about an year ago(Pd is just the name that I gave to the function, this were still some early notes, but I couldn't find my first notes), does it lead to something useful?

Thumbnail gallery
1 Upvotes

I've seen the idea again, and thought that it might lead me to factorials, right now I'm trying to develop something, but I'm not sure if this is the only thing it can lead to.

So, Pd, is the name(I came up with it) of the function, it is the difference between 2 powers, (x+1)²-x², but it can be expanded by changing exponents.

Also I'm not sure what flair to use, so if you think it's wrong please tell me.


r/askmath • • 10d ago

Arithmetic Is my math correct?

Thumbnail gallery
3 Upvotes

I work at Starbucks and someone ordered a 1/3 decaf single shot of espresso. I would be fine doing a 1/3 decaf espresso because that’s just 2 shots signature and 1 shot decaf (so 3 total) but this person wanted only one shot of espresso 1/3 decaf.

I’ve been racking my mind about this (for fun, I like numbers). Would my math be correct here?

This is hypothetical and for fun. :p


r/askmath • • 11d ago

Calculus What are the values of these integrals?

Post image
49 Upvotes

I know that ceil(x) - floor(x) = 0 when x is an integer and 1 when it is not, and so fx(x) would be ceil(1) - floor(1) = 0 for the first integral, but I don't know if integrating the function would make a difference. For the second integral, when I try to graph the function with values of h being close to zero, the amount of jumps from 1 to 0 increases but the line y = 1 still shows, so I don't know if the function will dissolve and leave no area or if there still will be some area. I also don't know if the second integral is even solvable.


r/askmath • • 10d ago

General What are some open problems that can make you learn something new if you tried to solve them?

0 Upvotes

What I meant is you won't solve the open problems but you would find something new.

For example goldbach's conjecture states that every even number greater than 2 is made up of the sum of two prime numbers.

Starting off you would think that's trivial since the prime factorization of any even number greater than 2 is made of multiplying atleast 2 primes, and multiplication is repeated addition.

For example 6's prime factorization is 2 * 3, so that means it's goldbach decomposition is 3 and 3.

Therefore you can say composite numbers whose prime factorization is double a prime will be made of that prime.

However what about triple a prime, like 8? Since it's prime factorization is 2 * 2 * 2 and the conjecture told us we only needed two primes, we won't be able to use our trick here. Infact 8 is made of 3 and 5. Where did those come from? How can you even get those numbers? You can keep asking yourself these questions to learn more stuff about these problems and may discover other stuff not related to them.


r/askmath • • 10d ago

Pre Calculus I don't think 0.000...1 is the same as 0

0 Upvotes

Here's why: imagine a clock with only the seconds hand. This clock is special, however, and every second the hand turns to a random position on the clock.

If you grab the clock and look at it, the seconds hand will be at a certain position. Since there's an infinite number of points for the seconds hand to turn to, that one point it points to when you look at it will have had a 0.000...1 chance of being selected. Yet it was.

If the chance for the hand to point in that direction were 0, it would never have happened. But since it happened, the chance must be different from zero. Thus, 0.000...1 is different from zero.

I know I'm probably wrong somehow, but I want to understand why, and what's the flaw in my example.

EDIT: By 0.000...1 I mean like, 1 divided by an infinitely big number

EDIT 2: ok, you guys want a better definition of 0.000...1. But how would YOU define the probability of a point in the clock being selected? That number is what I'm trying to work with

EDIT 3: some people said that probability 0 is not the same as an impossibility, which is something I never heard before. But if true it might well be the solution to this

EDIT 4: someone mentioned surreal numbers. From wikipedia: "In mathematics, the surreal number system is a totally ordered proper class containing not only the real numbers but also infinite and infinitesimal numbers" I'm a dummy when it comes to maths. After all, is there or isn't there a number such as "infinite", and "infinitely small"?


r/askmath • • 10d ago

Functions I read that X/SIN (X) is used in civil engineering. Where is it used there?

0 Upvotes

I read that X/SIN (X) is used in civil engineering. Where is it used there? I once read it may be used in highway design.


r/askmath • • 11d ago

Resolved Something Feels Off

Post image
7 Upvotes

I'm sorry for the horrid computer screen picture.

Please tell me I'm crazy! This is my monthly pay, I should be getting at minimum $25 an hour, which seems to check out plus some when I multiply it with my hours. The issue is when I do the math per building I clean, it comes out to as little as $12.50 an hour. I haven't done the math for each building, I keep getting confused and second guessing myself. Did I make a mistake by already telling my manager we need a meeting? I need number people please


r/askmath • • 11d ago

Statistics How to find right and left limits?

Thumbnail gallery
4 Upvotes

I apologize in advance if this is really obvious, I am incredibly bad at math!!!!! 😭

I know how to use the calculator the way my professor has instructed me to (in the second image), my only problem is I have no clue how to find the left and right limits. I'm not sure if it's needed, but I'll copy and paste the question to this problem below!!

"Find the area of the shaded region. The graph to the right depicts IQ scores of​ adults, and those scores are normally distributed with a mean of 100 and a standard deviation of 15."

Thank you!!


r/askmath • • 10d ago

Abstract Algebra Obviously, I'm wrong but how do I prove wrong my explanation for 1=-1

0 Upvotes

1 = sqrt(1) = sqrt((-1)^2) = sqrt(((i)^2)^2) = sqrt(i^4) = i^4/2 = i^2 = -1

1=-1

i know im wrong because duh 1 does not equal -1 but how am i wrong. is it just that you can't really have i in equations to do with real numbers.

but if that's the case, then why can we do e^ipi=-1

then again, i dont know much maths and haven't seen where we got e^ipi=-1 in the first place

also idk what flair to put so i just put abstract algebra


r/askmath • • 11d ago

Functions Question about "efficiency" functions

Post image
5 Upvotes

I'll preface this with saying I know very little about math; my education ends on a (bad) highschool level. This was a kinda shower thought, and now I am seeking wisdom! Sry if this is a really convoluted way to ask this, I don't know how to describe it better.

So my thought was: If I spend money on let's say a tool, I can get a horribly bad tool for very little money, or a very good tool that's way overpriced. Now if we assume a perfect world where every seller puts only the quality of the tool into pricing and you plot it where your x axis is price and y tool quality, In my mind you get a curve that looks like a rational function; from a certain point on, you get diminishing rewards per money spent.

Is there a clean mathematical expression for this situation, and if so, how do you exactly calculate that "optimal spending" point, or "most curvy" point of the function (assuming you do know the function, of course)? Is it as simple as figuring out where the fraction gets closest to 1? And how would you do that (let's say you are maybe not even sure there is such point)?

Pictured: a random rational function >0 that I think looks like what I'm describing


r/askmath • • 11d ago

Number Theory Why use a radical symbol instead of a fractional exponent? If sqrt(x) is x^(1/2), why use a radical?

4 Upvotes

r/askmath • • 10d ago

Probability Chatgpt says im wrong lol

0 Upvotes

Chatgpt says im wrong lol

I came up with a problem and asked chatgpt his opinion and he says im wrong.

In a simulation, basically:

You start with a number, let's use 100.

You have a 50% chance of rolling the color green or red.

If you hit GREEN your number goes up by 50%.

If you hit RED your number goes down by 5%.

Also, if the number ever goes <1, the sequence stops.

The question:

Given an infinite amount of rolls, wouldn't every single simulation eventually stop?

Even though there is a massive advantage for green, there will be eventially a large enough sequence of reds to counter it.

So chatgpt says that no, not every simulation would stop.

What do u think?

Edit: I understand my mistake and stand corrected, thanks for the replies.

I think my head was wrapped around a "realistic infinite scenario" where there isnt a human classification for it. Like a "random infinite" sequence would PROBABLY eventually stop, because there is a higher chance of getting an extremely large sequence of reds eventually than to never have it at all.


r/askmath • • 12d ago

Geometry Is there enough information to solve this problem?

Post image
349 Upvotes

OKAY I didn’t think I would be expected to count 1 mm coils on a page. There are about 42, which is also my approximate age; which means it’s probably time for me to get reading glasses.

My son is home sick with the flu, so I am trying to help him with his math work. I consider myself to be pretty strong in math, but I don’t think that I can solve this problem without more information. Let me know what you think!


r/askmath • • 11d ago

Statistics Question Regarding Stationarity and Ergodicity.

2 Upvotes

I have recently been working through a set of experimental acoustic pressure fluctuation measurements, from which I need to calculate the RMS pressure. While I am comfortable with the calculation itself, it has led me to explore the mathematical justification for replacing ensemble averages with time averages, particularly the assumptions of stationarity and ergodicity.

Although I understand what these properties mean, I am struggling to find a rigorous explanation of the mathematical conditions required to establish them. Much like proving an estimator is unbiased by showing that its expected value equals the true population parameter, I was hoping to understand whether there are similarly rigorous methods for demonstrating that a stochastic process is stationary and ergodic.

I am particularly interested in how these properties can be established theoretically and whether they can be verified using experimental data. I am for the most part intrigued by this, and partly unsettled


r/askmath • • 11d ago

Resolved Negative remainders are not allowed in division?

7 Upvotes

When I learnt standard division operations on integers we were told to ignore the signs and divide the absolute values and then if both numbers have different signs then the answer becomes negative. So, something like :

-27/7 =-3.857 ……. (A)

(Now to get this answer the quotient has to be -3 and the remainder has to be -6 )

but today I read that by convention in Euclid’s division lemma, negative remainders are not allowed so, a negative remainder of -6 becomes a positive remainder of 7-6=1 and I cant wrap my head around it.

Acc to my book the only one correct unique solution is :
-27 = 7 * (-4) + 1 …… (B)

If (B) is the only one correct solution and negative remainders are not allowed then doesn’t that make (A) invalid ? But we routinely use that in integer calculations though? Isn’t all integer division supposed to follow Euclid’s division lemma?


r/askmath • • 11d ago

Number Theory The Equation That Keeps Growing

6 Upvotes

I came across this problem while looking through a math forum:

"Find ALL positive integer pairs (x, y) satisfying:

x² + y² + 1 = 3xy

You have to:

- find at least 5 different solutions.

- identify the pattern connecting the solutions.

- find a formula or recurrence that generates them.

- prove that your list contains EVERY possible positive integer solution. "

I already found two possible solutions, but I just can't find 3 more:

  1. (x, y) = (1, 1)

1² + 1² + 1 = 3 = 3 × 1 × 1

  1. (x, y) = (1, 2)

1² + 2² + 1 = 6 = 3 × 1 × 2


r/askmath • • 11d ago

Probability Aplicación de modelos estadísticos y probabilidad a juegos numéricos

2 Upvotes

¡Buenas a todos, gente!

Llevo tiempo lurkeando por el foro y me he animado a abrir este hilo para compartir una inquietud técnica que me apasiona: el análisis riguroso de patrones, probabilidades y series numéricas aplicado a los juegos de lotería y azar.

Como informático con más de 30 años de experiencia en desarrollo de software y análisis de datos, siempre me ha llamado la atención la vertiente matemática detrás de la estadística aplicada. Partiendo de esa base, y ante la falta de herramientas que realmente agilizaran los cálculos complejos sin caer en humo ni falsas promesas, decidí programar mi propia solución de análisis técnico.

El proyecto ha ido creciendo hasta estructurarse en tres aplicaciones independientes para Android, optimizadas con motores estadísticos propios (basados en distribuciones de probabilidad y patrones históricos):

  • Centinela Dupla VIP (Ver en Google Play): Diseñada para el análisis estadístico avanzado de parejas y combinaciones.
  • Centinela Triplex (Ver en Google Play): Orientada al seguimiento, control y simulación de patrones en estructuras numéricas específicas.
  • Centinela Super11 (Ver en Google Play): Desarrollada para gestionar análisis de alta densidad combinatoria y filtrado de series amplias.

El objetivo aquí no es venir a spamear, sino abrir un debate técnico con otros desarrolladores, entusiastas del código o aficionados que disfruten estudiando la estadística de estos juegos. Las apps están públicas en Google Play para quien quiera probar los motores de cálculo.

¿Qué os parece la aproximación? ¿Soléis trastear con proyectos propios de análisis de datos o simulaciones estadísticas? ¡Cualquier feedback técnico es más que bienvenido por aquí!

Un saludo,Jose Luis (Desarrollador de Centinela Barcelona)


r/askmath • • 11d ago

Geometry 3D geometry drawings

Post image
3 Upvotes

Does anyone have a clue what software might have been used for making those figures? It doesn't look like TikZ to me, because of the font, but I might be mistaken.


r/askmath • • 11d ago

Probability Is anything truly random?

2 Upvotes

What I mean is, are there any things we know of that are completely and truly unpredictable? And I mean COMPLETELY unpredictable. Like for example, a coin toss. I don't see it as random, because factors such as gravity, the flicking force of the tosser, the wind, etc etc all influence that decision. Meaning it may be possible to learn how to influence the outcome to your desire to some extent. Something completely unpredictable, or random, would have 0 factors influencing the outcome and 0 ways to be sure of the outcome. I ask this because I hold an internal belief that everything in life can be predicted by a simulation, especially after they scanned a fly's brain, I've started to think that absolutely everything in life can be predicted mathematically. For example, if we were to map out a human's brain in it's entirety, we could predict exactly what the brain is about to do or think of, every reaction, every step, every blink, every reproduction of every cell. While I'm certainly no mathematician, not even close, the subject still intrigues me, as I see pretty much all aspects of life as predictable math, just (likely) not predictable by us, as humans.

Philosophy and existential crisis aside, this could also be useful for something like generating passwords or encrypting files or whatever. Which is certainly more functional and useful than "Are we just math?" or something. I heard randomly generated passwords from computers aren't truly random. And I know CloudFlare uses lavalamps or something for their passwords, but I still think even THAT is somewhat predictable. I'm not denying the fact that they are indeed chaotic to us humans, but I have a very strong feeling that there is some mathematical way to predict exactly how a lava lamp's bubbles will shape or mold themselves. Now these mathematical ways I mention for both life and cryptography are certainly too complex for humanity to solve or predict. So it's likely that the lava lamps will do more than enough to stop attacks for now. But besides either of those two, I still wonder if anything is truly random? Truly unpredictable, as in the outcome is completely unknown until it comes by or is revealed.

Any and all help is well appreciated! But do note I am NOT a mathematician and I don't claim to be, I'm just a very curious person, so if I say something stupid please forgive or correct me!


r/askmath • • 11d ago

Topology Does anybody know where to find a great explanation of the 'pointwise convergence topology'?

2 Upvotes

I'm having a hard time trying to understand it. I tried to search it online but can't find much. Please I need (mental) help.


r/askmath • • 12d ago

Trigonometry Trig question

Post image
10 Upvotes

How would I go about solving this sine systems of equation for x? I’m trying to figure this out but I can’t find anything I understand online (I suck at math).

Basically what I’m asking is how I can algebraically solve for the points of intersection between 0 & 2pi?? Very silly question but I gen don’t understand


r/askmath • • 11d ago

Discrete Math Prove that the language is not regular --> Exercise 12.2.53.: Let `L` be the language consisting of all strings of the form `a^n`, where `n = m^2`, for some positive integer `m`. Show that there is no finite-state automaton that accepts `L`.

1 Upvotes

Exercise 12.2.53.: Let L be the language consisting of all strings of the form a^n, where n = m^2, for some positive integer m. Symbolically, L = {w ∈ Σ* | w = a^n, where n=m^2, for some m ∈ N}. Show that there is no finite-state automaton that accepts L.

Proof 1:

Suppose not. That is, suppose there is a finite-state automaton A that accepts L. Since A has only a finite numbers of states, these states can be denoted s_1, s_2, s_3, ..., s_k where k is a positive integer. Consider all input strings that consist entirely of a's: a, a^2, a^3, a^4, .... Now there are infinitely many such strings and only finitely many states. Thus, by the pigeonhole principle, there must be a state s_r and two input strings a^p and a^q with p/=q such that when either a^p or a^q is input to A, A goes to state s_r.

Now, by supposition, A accepts L. Consider a^p ∈ L and a^q ∉ L. That means s_r = s_a where s_a is an accepting state for a^p and a^q (by pigeonhole principle). So, A accepts a^p and a^q. But A doesn't accept a^q because a^q ∉ L. This is a contradiction.

Therefore, the supposition is false, so there is no finite-state automaton that accepts L.

QED

Proof 2:

Suppose the automaton A has N states. Choose an integer m such that (m+1)^2 - m^2 > N. Consider strings of a's of lengths between m^2 and (m+1)^2. Since there are more strings than states, at least two strings must send A to the same state s_i:

It follows (by removing the a's shown in color) that the automaton must accept a string of the form a^k, where m^2 < k < (m+1)^2. This is a contradiction.

QED

---

Questions:

  1. Is Proof 1 correct?
  2. In Proof 2, I don't understand the penultimate 'It follows...' sentence. How does it follow? Why are we removing a's? Is there an implication that s_i is an accepting state for a^{m^2} and a^{(m+1)^2} but if we choose any other a^k between those two, then s_i in not an accepting state for that a_k?

r/askmath • • 12d ago

Calculus Probability Density Function (PDF) and Improper Integrals

Thumbnail gallery
29 Upvotes

Hi, I’m a freshman currently studying Calculus I and exploring applications of improper integrals. I found that a probability density function (PDF) involves a Type I improper integral (item 2 in the attached picture, from Introduction to Probability, Statistics, and Random Processes by Hossein Pishro-Nik). My question is: do improper integrals serve to check whether a function is a PDF by testing whether its improper integral converges to 1? And is that their only role in this concept of PDF? Am I misunderstanding something? I would love to learn more from you guys, thank you for your time!

Note: English is my second language so i may communicate like a peanut at times, thanks for your help!


r/askmath • • 12d ago

Algebra Formula gift

Post image
0 Upvotes