Number of solutions for a given logical equation
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I came across the following question while studying logic and cannot find a solution for it anywhere. I am studying by myself and think I just don't know exactly the right terms to search for it online (I'm not sure it is called a logical equation so excuse the title of this question in case it isn't):
Given the proposition $P$, it's logical value is defined as $[P] = 0$, in case $P$ is false, and $[P] = 1$, in case $P$ is true.
Consider the following open sentences defined in the set of integers:
$ P_i(x): x le 5$
$ P_ii(x): x ge 3$
$ P_iii(x): $ x is odd
$ P_iv(x): x ge 6$
How many solutions does the following equation have?
$ x = [P_i(x)] + 2 cdot[P_ii(x)]+3cdot[P_iii(x)]+4cdot[P_iv(x)]$
I've made this jsfiddle and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
combinatorics elementary-number-theory logic problem-solving
 |Â
show 5 more comments
up vote
5
down vote
favorite
I came across the following question while studying logic and cannot find a solution for it anywhere. I am studying by myself and think I just don't know exactly the right terms to search for it online (I'm not sure it is called a logical equation so excuse the title of this question in case it isn't):
Given the proposition $P$, it's logical value is defined as $[P] = 0$, in case $P$ is false, and $[P] = 1$, in case $P$ is true.
Consider the following open sentences defined in the set of integers:
$ P_i(x): x le 5$
$ P_ii(x): x ge 3$
$ P_iii(x): $ x is odd
$ P_iv(x): x ge 6$
How many solutions does the following equation have?
$ x = [P_i(x)] + 2 cdot[P_ii(x)]+3cdot[P_iii(x)]+4cdot[P_iv(x)]$
I've made this jsfiddle and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
combinatorics elementary-number-theory logic problem-solving
3
What have you tried? As a suggestion to get started, look at regions where the rules simplify. $x≥6$ for instance. Do even and odd separately.
– lulu
2 days ago
2
So, I've made this jsfiddle.net/6z1g3472/4 and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
– Delta
2 days ago
4
@Delta If you view the right hand side as a function of $x$, the smallest value it could possibly have independent of the definitions of the logical functions $P_i-iv$ is $0$ and the greatest value is $10$ (in the case that all the $P_i-iv$ are $1$. So you only needed to consider $x=0$ to $x=10$.
– Derek Elkins
2 days ago
2
Continuing from @DerekElkins's comment that you only need to consider integers from $0$ to $10$ regardless of the meanings of the $P$'s: Once you take a couple of the meanings into account and see that exactly one of $P_i$ and $P_iv$ is true, you're reduced to the range $1$ to $9$. So then I just tried all $9$ values of $x$. Admittedly, Rushabh's answer looks nicer, but I think mine might be faster to find.
– Andreas Blass
2 days ago
2
I have edited your question for you to include the context that you provided in a comment, but next time do put all such context in the question itself, to meet the site guidelines.
– user21820
2 days ago
 |Â
show 5 more comments
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I came across the following question while studying logic and cannot find a solution for it anywhere. I am studying by myself and think I just don't know exactly the right terms to search for it online (I'm not sure it is called a logical equation so excuse the title of this question in case it isn't):
Given the proposition $P$, it's logical value is defined as $[P] = 0$, in case $P$ is false, and $[P] = 1$, in case $P$ is true.
Consider the following open sentences defined in the set of integers:
$ P_i(x): x le 5$
$ P_ii(x): x ge 3$
$ P_iii(x): $ x is odd
$ P_iv(x): x ge 6$
How many solutions does the following equation have?
$ x = [P_i(x)] + 2 cdot[P_ii(x)]+3cdot[P_iii(x)]+4cdot[P_iv(x)]$
I've made this jsfiddle and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
combinatorics elementary-number-theory logic problem-solving
I came across the following question while studying logic and cannot find a solution for it anywhere. I am studying by myself and think I just don't know exactly the right terms to search for it online (I'm not sure it is called a logical equation so excuse the title of this question in case it isn't):
Given the proposition $P$, it's logical value is defined as $[P] = 0$, in case $P$ is false, and $[P] = 1$, in case $P$ is true.
Consider the following open sentences defined in the set of integers:
$ P_i(x): x le 5$
$ P_ii(x): x ge 3$
$ P_iii(x): $ x is odd
$ P_iv(x): x ge 6$
How many solutions does the following equation have?
$ x = [P_i(x)] + 2 cdot[P_ii(x)]+3cdot[P_iii(x)]+4cdot[P_iv(x)]$
I've made this jsfiddle and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
combinatorics elementary-number-theory logic problem-solving
combinatorics elementary-number-theory logic problem-solving
edited 2 days ago
user21820
36.2k440140
36.2k440140
asked 2 days ago


Delta
1999
1999
3
What have you tried? As a suggestion to get started, look at regions where the rules simplify. $x≥6$ for instance. Do even and odd separately.
– lulu
2 days ago
2
So, I've made this jsfiddle.net/6z1g3472/4 and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
– Delta
2 days ago
4
@Delta If you view the right hand side as a function of $x$, the smallest value it could possibly have independent of the definitions of the logical functions $P_i-iv$ is $0$ and the greatest value is $10$ (in the case that all the $P_i-iv$ are $1$. So you only needed to consider $x=0$ to $x=10$.
– Derek Elkins
2 days ago
2
Continuing from @DerekElkins's comment that you only need to consider integers from $0$ to $10$ regardless of the meanings of the $P$'s: Once you take a couple of the meanings into account and see that exactly one of $P_i$ and $P_iv$ is true, you're reduced to the range $1$ to $9$. So then I just tried all $9$ values of $x$. Admittedly, Rushabh's answer looks nicer, but I think mine might be faster to find.
– Andreas Blass
2 days ago
2
I have edited your question for you to include the context that you provided in a comment, but next time do put all such context in the question itself, to meet the site guidelines.
– user21820
2 days ago
 |Â
show 5 more comments
3
What have you tried? As a suggestion to get started, look at regions where the rules simplify. $x≥6$ for instance. Do even and odd separately.
– lulu
2 days ago
2
So, I've made this jsfiddle.net/6z1g3472/4 and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
– Delta
2 days ago
4
@Delta If you view the right hand side as a function of $x$, the smallest value it could possibly have independent of the definitions of the logical functions $P_i-iv$ is $0$ and the greatest value is $10$ (in the case that all the $P_i-iv$ are $1$. So you only needed to consider $x=0$ to $x=10$.
– Derek Elkins
2 days ago
2
Continuing from @DerekElkins's comment that you only need to consider integers from $0$ to $10$ regardless of the meanings of the $P$'s: Once you take a couple of the meanings into account and see that exactly one of $P_i$ and $P_iv$ is true, you're reduced to the range $1$ to $9$. So then I just tried all $9$ values of $x$. Admittedly, Rushabh's answer looks nicer, but I think mine might be faster to find.
– Andreas Blass
2 days ago
2
I have edited your question for you to include the context that you provided in a comment, but next time do put all such context in the question itself, to meet the site guidelines.
– user21820
2 days ago
3
3
What have you tried? As a suggestion to get started, look at regions where the rules simplify. $x≥6$ for instance. Do even and odd separately.
– lulu
2 days ago
What have you tried? As a suggestion to get started, look at regions where the rules simplify. $x≥6$ for instance. Do even and odd separately.
– lulu
2 days ago
2
2
So, I've made this jsfiddle.net/6z1g3472/4 and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
– Delta
2 days ago
So, I've made this jsfiddle.net/6z1g3472/4 and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
– Delta
2 days ago
4
4
@Delta If you view the right hand side as a function of $x$, the smallest value it could possibly have independent of the definitions of the logical functions $P_i-iv$ is $0$ and the greatest value is $10$ (in the case that all the $P_i-iv$ are $1$. So you only needed to consider $x=0$ to $x=10$.
– Derek Elkins
2 days ago
@Delta If you view the right hand side as a function of $x$, the smallest value it could possibly have independent of the definitions of the logical functions $P_i-iv$ is $0$ and the greatest value is $10$ (in the case that all the $P_i-iv$ are $1$. So you only needed to consider $x=0$ to $x=10$.
– Derek Elkins
2 days ago
2
2
Continuing from @DerekElkins's comment that you only need to consider integers from $0$ to $10$ regardless of the meanings of the $P$'s: Once you take a couple of the meanings into account and see that exactly one of $P_i$ and $P_iv$ is true, you're reduced to the range $1$ to $9$. So then I just tried all $9$ values of $x$. Admittedly, Rushabh's answer looks nicer, but I think mine might be faster to find.
– Andreas Blass
2 days ago
Continuing from @DerekElkins's comment that you only need to consider integers from $0$ to $10$ regardless of the meanings of the $P$'s: Once you take a couple of the meanings into account and see that exactly one of $P_i$ and $P_iv$ is true, you're reduced to the range $1$ to $9$. So then I just tried all $9$ values of $x$. Admittedly, Rushabh's answer looks nicer, but I think mine might be faster to find.
– Andreas Blass
2 days ago
2
2
I have edited your question for you to include the context that you provided in a comment, but next time do put all such context in the question itself, to meet the site guidelines.
– user21820
2 days ago
I have edited your question for you to include the context that you provided in a comment, but next time do put all such context in the question itself, to meet the site guidelines.
– user21820
2 days ago
 |Â
show 5 more comments
4 Answers
4
active
oldest
votes
up vote
6
down vote
accepted
First, let's observe that $[P_i(x)]+4cdot[P_iv(x)]=1+3cdot[P_iv(x)]$. We can check three cases:
$x<3$: Our equation becomes $x=1+3cdot(x%2)$ where $%$ is the mod operator. Clearly, no even number can satisfy this equation, and neither can an odd number. So, $xgeq3$.
$3leq x<6$ We can convert the equation to $x=3+3cdot(x%2)$. Again, no even or odd numbers can satisfy this equation, so we move on to case three.
$xgeq6$ Since we know any solution must satisfy this, we can convert the equation to $6+3cdot(x%2)$. So, $x=6$ and $x=9$ are solutions.
Hence, there are $colorred2$ solutions to this equation.
add a comment |Â
up vote
5
down vote
Here's how this problem would be coded in the SMT-LIB format, understood by most SMT solvers.
(define-fun Pi ((x Int)) Int (ite (<= x 5) 1 0))
(define-fun Pii ((x Int)) Int (ite (>= x 3) 1 0))
(define-fun Piii ((x Int)) Int (mod x 2))
(define-fun Piv ((x Int)) Int (ite (>= x 6) 1 0))
(declare-const x Int)
(assert (= x (+ (Pi x) (* 2 (Pii x)) (* 3 (Piii x)) (* 4 (Piv x)))))
(check-sat)
(get-model)
(assert (not (= x 6)))
(check-sat)
(get-model)
(assert (not (= x 9)))
(check-sat)
(exit)
After getting the first solution, we add a constraint that forbids that solution and solve again. When we do it again, the SMT solver reports that the constraints are now unsatisfiable; hence we know that we have enumerated all solutions.
add a comment |Â
up vote
4
down vote
Other answers show how to get a full solution, with a bit of thought/work. But a very quick observation that narrows down the possibilities is that since logical functions can only take values $0$ and $1$, the right-hand side can’t be more than $1 + 2cdot1 + 3cdot1 + 4cdot1 = 10$, and can’t be less than $0$. So the only values you need to try for $x$ are $0, 1, …, 10$.
This is something always worth thinking of: when some complex function (like the right-hand side here) is built out of other functions, if you know restrictions/bounds on the pieces it’s build out of, then those will often give restrictions/bounds on the complex function.
(Justifying the bounds in detail: if $a geq 0$ and $0 leq b leq 1$, then $0 leq ab leq a$. So $0 leq 2cdot [P_2(x)] leq 2$, and so on; so for any $x$, $$0 = 0 + 0 + 0 + 0 leq [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)] leq 1 + 2 + 3 + 4 = 10$$
and so in particular, if $x = [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)]$, then $0 leq x leq 10$.)
add a comment |Â
up vote
1
down vote
In addition to @Rushabh Mehta's answer:
note that $[P_i]$ can be seen as a "classic" (aka Pre-Calculus) function. For example, $f_1=[P_1]$ is simply the function $$f_1(x)=[P_1(x)]=left{ beginarrayrl 1, & x leqslant 5 \ 0, &x>5 endarray right.$$
Therefore, you can study the given equation $x=f_1(x)+2f_2(x)+3f_3(x)+4f_4(x)$ using all techniques you already knows for this kind of problems: considering cases (as in Rushabh Mehta's answer), drawing the graph carefully,...
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
First, let's observe that $[P_i(x)]+4cdot[P_iv(x)]=1+3cdot[P_iv(x)]$. We can check three cases:
$x<3$: Our equation becomes $x=1+3cdot(x%2)$ where $%$ is the mod operator. Clearly, no even number can satisfy this equation, and neither can an odd number. So, $xgeq3$.
$3leq x<6$ We can convert the equation to $x=3+3cdot(x%2)$. Again, no even or odd numbers can satisfy this equation, so we move on to case three.
$xgeq6$ Since we know any solution must satisfy this, we can convert the equation to $6+3cdot(x%2)$. So, $x=6$ and $x=9$ are solutions.
Hence, there are $colorred2$ solutions to this equation.
add a comment |Â
up vote
6
down vote
accepted
First, let's observe that $[P_i(x)]+4cdot[P_iv(x)]=1+3cdot[P_iv(x)]$. We can check three cases:
$x<3$: Our equation becomes $x=1+3cdot(x%2)$ where $%$ is the mod operator. Clearly, no even number can satisfy this equation, and neither can an odd number. So, $xgeq3$.
$3leq x<6$ We can convert the equation to $x=3+3cdot(x%2)$. Again, no even or odd numbers can satisfy this equation, so we move on to case three.
$xgeq6$ Since we know any solution must satisfy this, we can convert the equation to $6+3cdot(x%2)$. So, $x=6$ and $x=9$ are solutions.
Hence, there are $colorred2$ solutions to this equation.
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
First, let's observe that $[P_i(x)]+4cdot[P_iv(x)]=1+3cdot[P_iv(x)]$. We can check three cases:
$x<3$: Our equation becomes $x=1+3cdot(x%2)$ where $%$ is the mod operator. Clearly, no even number can satisfy this equation, and neither can an odd number. So, $xgeq3$.
$3leq x<6$ We can convert the equation to $x=3+3cdot(x%2)$. Again, no even or odd numbers can satisfy this equation, so we move on to case three.
$xgeq6$ Since we know any solution must satisfy this, we can convert the equation to $6+3cdot(x%2)$. So, $x=6$ and $x=9$ are solutions.
Hence, there are $colorred2$ solutions to this equation.
First, let's observe that $[P_i(x)]+4cdot[P_iv(x)]=1+3cdot[P_iv(x)]$. We can check three cases:
$x<3$: Our equation becomes $x=1+3cdot(x%2)$ where $%$ is the mod operator. Clearly, no even number can satisfy this equation, and neither can an odd number. So, $xgeq3$.
$3leq x<6$ We can convert the equation to $x=3+3cdot(x%2)$. Again, no even or odd numbers can satisfy this equation, so we move on to case three.
$xgeq6$ Since we know any solution must satisfy this, we can convert the equation to $6+3cdot(x%2)$. So, $x=6$ and $x=9$ are solutions.
Hence, there are $colorred2$ solutions to this equation.
answered 2 days ago
Rushabh Mehta
2,141220
2,141220
add a comment |Â
add a comment |Â
up vote
5
down vote
Here's how this problem would be coded in the SMT-LIB format, understood by most SMT solvers.
(define-fun Pi ((x Int)) Int (ite (<= x 5) 1 0))
(define-fun Pii ((x Int)) Int (ite (>= x 3) 1 0))
(define-fun Piii ((x Int)) Int (mod x 2))
(define-fun Piv ((x Int)) Int (ite (>= x 6) 1 0))
(declare-const x Int)
(assert (= x (+ (Pi x) (* 2 (Pii x)) (* 3 (Piii x)) (* 4 (Piv x)))))
(check-sat)
(get-model)
(assert (not (= x 6)))
(check-sat)
(get-model)
(assert (not (= x 9)))
(check-sat)
(exit)
After getting the first solution, we add a constraint that forbids that solution and solve again. When we do it again, the SMT solver reports that the constraints are now unsatisfiable; hence we know that we have enumerated all solutions.
add a comment |Â
up vote
5
down vote
Here's how this problem would be coded in the SMT-LIB format, understood by most SMT solvers.
(define-fun Pi ((x Int)) Int (ite (<= x 5) 1 0))
(define-fun Pii ((x Int)) Int (ite (>= x 3) 1 0))
(define-fun Piii ((x Int)) Int (mod x 2))
(define-fun Piv ((x Int)) Int (ite (>= x 6) 1 0))
(declare-const x Int)
(assert (= x (+ (Pi x) (* 2 (Pii x)) (* 3 (Piii x)) (* 4 (Piv x)))))
(check-sat)
(get-model)
(assert (not (= x 6)))
(check-sat)
(get-model)
(assert (not (= x 9)))
(check-sat)
(exit)
After getting the first solution, we add a constraint that forbids that solution and solve again. When we do it again, the SMT solver reports that the constraints are now unsatisfiable; hence we know that we have enumerated all solutions.
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Here's how this problem would be coded in the SMT-LIB format, understood by most SMT solvers.
(define-fun Pi ((x Int)) Int (ite (<= x 5) 1 0))
(define-fun Pii ((x Int)) Int (ite (>= x 3) 1 0))
(define-fun Piii ((x Int)) Int (mod x 2))
(define-fun Piv ((x Int)) Int (ite (>= x 6) 1 0))
(declare-const x Int)
(assert (= x (+ (Pi x) (* 2 (Pii x)) (* 3 (Piii x)) (* 4 (Piv x)))))
(check-sat)
(get-model)
(assert (not (= x 6)))
(check-sat)
(get-model)
(assert (not (= x 9)))
(check-sat)
(exit)
After getting the first solution, we add a constraint that forbids that solution and solve again. When we do it again, the SMT solver reports that the constraints are now unsatisfiable; hence we know that we have enumerated all solutions.
Here's how this problem would be coded in the SMT-LIB format, understood by most SMT solvers.
(define-fun Pi ((x Int)) Int (ite (<= x 5) 1 0))
(define-fun Pii ((x Int)) Int (ite (>= x 3) 1 0))
(define-fun Piii ((x Int)) Int (mod x 2))
(define-fun Piv ((x Int)) Int (ite (>= x 6) 1 0))
(declare-const x Int)
(assert (= x (+ (Pi x) (* 2 (Pii x)) (* 3 (Piii x)) (* 4 (Piv x)))))
(check-sat)
(get-model)
(assert (not (= x 6)))
(check-sat)
(get-model)
(assert (not (= x 9)))
(check-sat)
(exit)
After getting the first solution, we add a constraint that forbids that solution and solve again. When we do it again, the SMT solver reports that the constraints are now unsatisfiable; hence we know that we have enumerated all solutions.
edited 2 days ago
answered 2 days ago
Fabio Somenzi
5,85721221
5,85721221
add a comment |Â
add a comment |Â
up vote
4
down vote
Other answers show how to get a full solution, with a bit of thought/work. But a very quick observation that narrows down the possibilities is that since logical functions can only take values $0$ and $1$, the right-hand side can’t be more than $1 + 2cdot1 + 3cdot1 + 4cdot1 = 10$, and can’t be less than $0$. So the only values you need to try for $x$ are $0, 1, …, 10$.
This is something always worth thinking of: when some complex function (like the right-hand side here) is built out of other functions, if you know restrictions/bounds on the pieces it’s build out of, then those will often give restrictions/bounds on the complex function.
(Justifying the bounds in detail: if $a geq 0$ and $0 leq b leq 1$, then $0 leq ab leq a$. So $0 leq 2cdot [P_2(x)] leq 2$, and so on; so for any $x$, $$0 = 0 + 0 + 0 + 0 leq [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)] leq 1 + 2 + 3 + 4 = 10$$
and so in particular, if $x = [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)]$, then $0 leq x leq 10$.)
add a comment |Â
up vote
4
down vote
Other answers show how to get a full solution, with a bit of thought/work. But a very quick observation that narrows down the possibilities is that since logical functions can only take values $0$ and $1$, the right-hand side can’t be more than $1 + 2cdot1 + 3cdot1 + 4cdot1 = 10$, and can’t be less than $0$. So the only values you need to try for $x$ are $0, 1, …, 10$.
This is something always worth thinking of: when some complex function (like the right-hand side here) is built out of other functions, if you know restrictions/bounds on the pieces it’s build out of, then those will often give restrictions/bounds on the complex function.
(Justifying the bounds in detail: if $a geq 0$ and $0 leq b leq 1$, then $0 leq ab leq a$. So $0 leq 2cdot [P_2(x)] leq 2$, and so on; so for any $x$, $$0 = 0 + 0 + 0 + 0 leq [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)] leq 1 + 2 + 3 + 4 = 10$$
and so in particular, if $x = [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)]$, then $0 leq x leq 10$.)
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Other answers show how to get a full solution, with a bit of thought/work. But a very quick observation that narrows down the possibilities is that since logical functions can only take values $0$ and $1$, the right-hand side can’t be more than $1 + 2cdot1 + 3cdot1 + 4cdot1 = 10$, and can’t be less than $0$. So the only values you need to try for $x$ are $0, 1, …, 10$.
This is something always worth thinking of: when some complex function (like the right-hand side here) is built out of other functions, if you know restrictions/bounds on the pieces it’s build out of, then those will often give restrictions/bounds on the complex function.
(Justifying the bounds in detail: if $a geq 0$ and $0 leq b leq 1$, then $0 leq ab leq a$. So $0 leq 2cdot [P_2(x)] leq 2$, and so on; so for any $x$, $$0 = 0 + 0 + 0 + 0 leq [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)] leq 1 + 2 + 3 + 4 = 10$$
and so in particular, if $x = [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)]$, then $0 leq x leq 10$.)
Other answers show how to get a full solution, with a bit of thought/work. But a very quick observation that narrows down the possibilities is that since logical functions can only take values $0$ and $1$, the right-hand side can’t be more than $1 + 2cdot1 + 3cdot1 + 4cdot1 = 10$, and can’t be less than $0$. So the only values you need to try for $x$ are $0, 1, …, 10$.
This is something always worth thinking of: when some complex function (like the right-hand side here) is built out of other functions, if you know restrictions/bounds on the pieces it’s build out of, then those will often give restrictions/bounds on the complex function.
(Justifying the bounds in detail: if $a geq 0$ and $0 leq b leq 1$, then $0 leq ab leq a$. So $0 leq 2cdot [P_2(x)] leq 2$, and so on; so for any $x$, $$0 = 0 + 0 + 0 + 0 leq [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)] leq 1 + 2 + 3 + 4 = 10$$
and so in particular, if $x = [P_1(x)] + 2cdot [P_2(x)] + 3cdot [P_3(x)] + 4cdot [P_4(x)]$, then $0 leq x leq 10$.)
edited 2 days ago
answered 2 days ago
Peter LeFanu Lumsdaine
5,66241740
5,66241740
add a comment |Â
add a comment |Â
up vote
1
down vote
In addition to @Rushabh Mehta's answer:
note that $[P_i]$ can be seen as a "classic" (aka Pre-Calculus) function. For example, $f_1=[P_1]$ is simply the function $$f_1(x)=[P_1(x)]=left{ beginarrayrl 1, & x leqslant 5 \ 0, &x>5 endarray right.$$
Therefore, you can study the given equation $x=f_1(x)+2f_2(x)+3f_3(x)+4f_4(x)$ using all techniques you already knows for this kind of problems: considering cases (as in Rushabh Mehta's answer), drawing the graph carefully,...
add a comment |Â
up vote
1
down vote
In addition to @Rushabh Mehta's answer:
note that $[P_i]$ can be seen as a "classic" (aka Pre-Calculus) function. For example, $f_1=[P_1]$ is simply the function $$f_1(x)=[P_1(x)]=left{ beginarrayrl 1, & x leqslant 5 \ 0, &x>5 endarray right.$$
Therefore, you can study the given equation $x=f_1(x)+2f_2(x)+3f_3(x)+4f_4(x)$ using all techniques you already knows for this kind of problems: considering cases (as in Rushabh Mehta's answer), drawing the graph carefully,...
add a comment |Â
up vote
1
down vote
up vote
1
down vote
In addition to @Rushabh Mehta's answer:
note that $[P_i]$ can be seen as a "classic" (aka Pre-Calculus) function. For example, $f_1=[P_1]$ is simply the function $$f_1(x)=[P_1(x)]=left{ beginarrayrl 1, & x leqslant 5 \ 0, &x>5 endarray right.$$
Therefore, you can study the given equation $x=f_1(x)+2f_2(x)+3f_3(x)+4f_4(x)$ using all techniques you already knows for this kind of problems: considering cases (as in Rushabh Mehta's answer), drawing the graph carefully,...
In addition to @Rushabh Mehta's answer:
note that $[P_i]$ can be seen as a "classic" (aka Pre-Calculus) function. For example, $f_1=[P_1]$ is simply the function $$f_1(x)=[P_1(x)]=left{ beginarrayrl 1, & x leqslant 5 \ 0, &x>5 endarray right.$$
Therefore, you can study the given equation $x=f_1(x)+2f_2(x)+3f_3(x)+4f_4(x)$ using all techniques you already knows for this kind of problems: considering cases (as in Rushabh Mehta's answer), drawing the graph carefully,...
answered 2 days ago
Taladris
4,39731732
4,39731732
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2911315%2fnumber-of-solutions-for-a-given-logical-equation%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3
What have you tried? As a suggestion to get started, look at regions where the rules simplify. $x≥6$ for instance. Do even and odd separately.
– lulu
2 days ago
2
So, I've made this jsfiddle.net/6z1g3472/4 and from there, I can count the number of solutions through a loop. In this case I've looped from 0 to 1000 and it yields 2 solutions. Though I can clearly reason it wouldn't be possible for a very large number to work here, since these are all sums of multiplications of 0s or 1s, I am having a hard time articulating exactly why. How would you go about finding the largest number possible, in this very specific case? So you wouldn't have to loop through values of X too far off from it?
– Delta
2 days ago
4
@Delta If you view the right hand side as a function of $x$, the smallest value it could possibly have independent of the definitions of the logical functions $P_i-iv$ is $0$ and the greatest value is $10$ (in the case that all the $P_i-iv$ are $1$. So you only needed to consider $x=0$ to $x=10$.
– Derek Elkins
2 days ago
2
Continuing from @DerekElkins's comment that you only need to consider integers from $0$ to $10$ regardless of the meanings of the $P$'s: Once you take a couple of the meanings into account and see that exactly one of $P_i$ and $P_iv$ is true, you're reduced to the range $1$ to $9$. So then I just tried all $9$ values of $x$. Admittedly, Rushabh's answer looks nicer, but I think mine might be faster to find.
– Andreas Blass
2 days ago
2
I have edited your question for you to include the context that you provided in a comment, but next time do put all such context in the question itself, to meet the site guidelines.
– user21820
2 days ago